1
0
Fork 0
mirror of https://github.com/oMaN-Rod/nxDumpFuse.git synced 2024-09-16 20:13:27 +01:00

Improve file dialog behavior

This commit is contained in:
I_aM_O 2022-11-26 17:00:23 -05:00
parent e53e074ff6
commit bd9ce2e507
4 changed files with 29 additions and 11 deletions

View file

@ -3,6 +3,10 @@
"nxDumpFuse": { "nxDumpFuse": {
"commandName": "Project", "commandName": "Project",
"commandLineArgs": "/l Trace" "commandLineArgs": "/l Trace"
},
"WSL": {
"commandName": "WSL2",
"distributionName": ""
} }
} }
} }

View file

@ -1,4 +1,5 @@
using System.Threading.Tasks; using System.Collections.Generic;
using System.Threading.Tasks;
using Avalonia.Controls; using Avalonia.Controls;
using nxDumpFuse.ViewModels.Interfaces; using nxDumpFuse.ViewModels.Interfaces;
@ -15,14 +16,18 @@ namespace nxDumpFuse.Services
public async Task<string> ShowOpenFileDialogAsync(string title, FileDialogFilter filter) public async Task<string> ShowOpenFileDialogAsync(string title, FileDialogFilter filter)
{ {
var openFileDialog = new OpenFileDialog() var openFileDialog = new OpenFileDialog
{ {
Title = title, Title = title,
AllowMultiple = false AllowMultiple = false
}; };
openFileDialog.Filters.Add(filter); openFileDialog.Filters!.Add(filter);
var result = await openFileDialog.ShowAsync(_mainWindowProvider.GetMainWindow()); var result = await openFileDialog.ShowAsync(_mainWindowProvider.GetMainWindow());
if (result == null)
{
return string.Empty;
}
return result.Length == 0 ? string.Empty : result[0]; return result.Length == 0 ? string.Empty : result[0];
} }
@ -32,7 +37,8 @@ namespace nxDumpFuse.Services
{ {
Title = title Title = title
}; };
return await openFolderDialog.ShowAsync(_mainWindowProvider.GetMainWindow()); var result = await openFolderDialog.ShowAsync(_mainWindowProvider.GetMainWindow());
return result ?? string.Empty;
} }
} }
} }

View file

@ -55,6 +55,7 @@ namespace nxDumpFuse.ViewModels
public ReactiveCommand<Unit, Unit> StopCommand { get; } public ReactiveCommand<Unit, Unit> StopCommand { get; }
private bool _isBusy; private bool _isBusy;
public bool IsBusy public bool IsBusy
{ {
get => _isBusy; get => _isBusy;
@ -62,6 +63,7 @@ namespace nxDumpFuse.ViewModels
} }
private string _inputFilePath = string.Empty; private string _inputFilePath = string.Empty;
public string InputFilePath public string InputFilePath
{ {
get => _inputFilePath; get => _inputFilePath;
@ -69,6 +71,7 @@ namespace nxDumpFuse.ViewModels
} }
private string _outputDir = string.Empty; private string _outputDir = string.Empty;
public string OutputDir public string OutputDir
{ {
get => _outputDir; get => _outputDir;
@ -76,6 +79,7 @@ namespace nxDumpFuse.ViewModels
} }
private string _progressPartText = string.Empty; private string _progressPartText = string.Empty;
public string ProgressPartText public string ProgressPartText
{ {
get => _progressPartText; get => _progressPartText;
@ -83,6 +87,7 @@ namespace nxDumpFuse.ViewModels
} }
private double _progressPart; private double _progressPart;
public double ProgressPart public double ProgressPart
{ {
get => _progressPart; get => _progressPart;
@ -90,6 +95,7 @@ namespace nxDumpFuse.ViewModels
} }
private double _progress; private double _progress;
public double Progress public double Progress
{ {
get => _progress; get => _progress;
@ -97,6 +103,7 @@ namespace nxDumpFuse.ViewModels
} }
private string _progressText = string.Empty; private string _progressText = string.Empty;
public string ProgressText public string ProgressText
{ {
get => _progressText; get => _progressText;
@ -104,6 +111,7 @@ namespace nxDumpFuse.ViewModels
} }
private ObservableCollection<FuseSimpleLog> _logItems = new(); private ObservableCollection<FuseSimpleLog> _logItems = new();
public ObservableCollection<FuseSimpleLog> LogItems public ObservableCollection<FuseSimpleLog> LogItems
{ {
get => _logItems; get => _logItems;
@ -143,7 +151,7 @@ namespace nxDumpFuse.ViewModels
private async void SelectInputFile() private async void SelectInputFile()
{ {
InputFilePath = await _dialogService.ShowOpenFileDialogAsync("Choose Input File", InputFilePath = await _dialogService.ShowOpenFileDialogAsync("Choose Input File",
new FileDialogFilter { Name = string.Empty, Extensions = new List<string>() }); new FileDialogFilter { Name = string.Empty, Extensions = new List<string> { "*" } });
} }
private async void SelectOutputFolder() private async void SelectOutputFolder()

View file

@ -6,7 +6,7 @@
<SelfContained>true</SelfContained> <SelfContained>true</SelfContained>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract> <IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<RuntimeIdentifier>win10-x64</RuntimeIdentifier> <RuntimeIdentifier>win10-x64</RuntimeIdentifier>
<!--<RuntimeIdentifier>linux-x64</RuntimeIdentifier>--> <!-- <RuntimeIdentifier>linux-x64</RuntimeIdentifier> -->
<!--<RuntimeIdentifier>osx-x64</RuntimeIdentifier>--> <!--<RuntimeIdentifier>osx-x64</RuntimeIdentifier>-->
<PublishSingleFile>true</PublishSingleFile> <PublishSingleFile>true</PublishSingleFile>
<PublishTrimmed>true</PublishTrimmed> <PublishTrimmed>true</PublishTrimmed>
@ -22,12 +22,12 @@
<EmbeddedResource Include="Assets\github_icon.png" /> <EmbeddedResource Include="Assets\github_icon.png" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.8" /> <PackageReference Include="Avalonia" Version="0.10.18" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.8" /> <PackageReference Include="Avalonia.Desktop" Version="0.10.18" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="0.10.8" /> <PackageReference Include="Avalonia.Controls.DataGrid" Version="0.10.18" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.--> <!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.8" /> <PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.18" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.8" /> <PackageReference Include="Avalonia.ReactiveUI" Version="0.10.18" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Update="Views\AboutView.axaml.cs"> <Compile Update="Views\AboutView.axaml.cs">