mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Fix weird bug with CommonFileDialogFilters
This commit is contained in:
parent
ab7e2cb879
commit
4ef0b67a82
@ -291,11 +291,11 @@ namespace Wabbajack.Test
|
||||
public async Task FileWithFilters_Passes()
|
||||
{
|
||||
var vm = new FilePickerVM();
|
||||
await using (CreateSetFile(vm))
|
||||
await using (var file = CreateSetFile(vm))
|
||||
{
|
||||
vm.PathType = FilePickerVM.PathTypeOptions.File;
|
||||
vm.ExistCheckOption = FilePickerVM.CheckOptions.Off;
|
||||
vm.Filters.Add(new Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialogFilter("test", $"*.{vm.TargetPath.Extension}"));
|
||||
vm.Filters.Add(new Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialogFilter("test", $"*{vm.TargetPath.Extension}"));
|
||||
await Task.Delay(250);
|
||||
Assert.False(vm.Exists);
|
||||
Assert.True(vm.ErrorState.Succeeded);
|
||||
@ -312,7 +312,7 @@ namespace Wabbajack.Test
|
||||
{
|
||||
vm.PathType = FilePickerVM.PathTypeOptions.File;
|
||||
vm.ExistCheckOption = FilePickerVM.CheckOptions.Off;
|
||||
vm.Filters.Add(new Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialogFilter("test", $"*.{vm.TargetPath.Extension}z"));
|
||||
vm.Filters.Add(new Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialogFilter("test", $"*{vm.TargetPath.Extension}z"));
|
||||
await Task.Delay(250);
|
||||
Assert.False(vm.Exists);
|
||||
Assert.False(vm.ErrorState.Succeeded);
|
||||
@ -328,7 +328,7 @@ namespace Wabbajack.Test
|
||||
vm.PathType = FilePickerVM.PathTypeOptions.File;
|
||||
vm.ExistCheckOption = FilePickerVM.CheckOptions.Off;
|
||||
vm.TargetPath = (AbsolutePath)"SomePath.png";
|
||||
vm.Filters.Add(new Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialogFilter("test", $"*.{vm.TargetPath.Extension}"));
|
||||
vm.Filters.Add(new Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialogFilter("test", $"*{vm.TargetPath.Extension}"));
|
||||
await Task.Delay(250);
|
||||
Assert.False(vm.Exists);
|
||||
Assert.True(vm.ErrorState.Succeeded, vm.ErrorState.Reason);
|
||||
@ -345,7 +345,7 @@ namespace Wabbajack.Test
|
||||
ExistCheckOption = FilePickerVM.CheckOptions.Off,
|
||||
FilterCheckOption = FilePickerVM.CheckOptions.IfPathNotEmpty
|
||||
};
|
||||
vm.Filters.Add(new Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialogFilter("test", $"*.{vm.TargetPath.Extension}"));
|
||||
vm.Filters.Add(new Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialogFilter("test", $"*{vm.TargetPath.Extension}"));
|
||||
await Task.Delay(250);
|
||||
Assert.False(vm.Exists);
|
||||
Assert.True(vm.ErrorState.Succeeded);
|
||||
|
@ -65,7 +65,7 @@ namespace Wabbajack
|
||||
private readonly ObservableAsPropertyHelper<string> _errorTooltip;
|
||||
public string ErrorTooltip => _errorTooltip.Value;
|
||||
|
||||
public SourceList<CommonFileDialogFilter> Filters { get; } = new SourceList<CommonFileDialogFilter>();
|
||||
public SourceList<CommonFileDialogFilter> Filters { get; } = new();
|
||||
|
||||
public const string PathDoesNotExistText = "Path does not exist";
|
||||
public const string DoesNotPassFiltersText = "Path does not pass designated filters";
|
||||
@ -158,6 +158,7 @@ namespace Wabbajack
|
||||
Filters.Connect().QueryWhenChanged(),
|
||||
resultSelector: (target, type, checkOption, query) =>
|
||||
{
|
||||
Console.WriteLine("fff");
|
||||
switch (type)
|
||||
{
|
||||
case PathTypeOptions.Either:
|
||||
|
@ -50,7 +50,7 @@ namespace Wabbajack
|
||||
PathType = FilePickerVM.PathTypeOptions.File,
|
||||
PromptTitle = "Select a Modlist"
|
||||
};
|
||||
ModListLocation.Filters.Add(new CommonFileDialogFilter("MO2 Profile (modlist.txt) or Native Settings (native_compiler_settings.json)", ".txt,.json"));
|
||||
ModListLocation.Filters.Add(new CommonFileDialogFilter("MO2 Profile (modlist.txt) or Native Settings (native_compiler_settings.json)", "*.txt,*.json"));
|
||||
|
||||
DownloadLocation = new FilePickerVM()
|
||||
{
|
||||
|
@ -113,7 +113,7 @@ namespace Wabbajack
|
||||
PathType = FilePickerVM.PathTypeOptions.File,
|
||||
PromptTitle = "Select a ModList to install"
|
||||
};
|
||||
ModListLocation.Filters.Add(new CommonFileDialogFilter("Wabbajack Modlist", ".wabbajack"));
|
||||
ModListLocation.Filters.Add(new CommonFileDialogFilter("Wabbajack Modlist", "*.wabbajack"));
|
||||
|
||||
// Swap to proper sub VM based on selected type
|
||||
_installer = this.WhenAny(x => x.TargetManager)
|
||||
|
Loading…
Reference in New Issue
Block a user