mirror of
https://github.com/oMaN-Rod/nxDumpFuse.git
synced 2024-11-25 11:42:16 +00:00
Improve file dialog behavior
This commit is contained in:
parent
e53e074ff6
commit
bd9ce2e507
4 changed files with 29 additions and 11 deletions
|
@ -3,6 +3,10 @@
|
|||
"nxDumpFuse": {
|
||||
"commandName": "Project",
|
||||
"commandLineArgs": "/l Trace"
|
||||
},
|
||||
"WSL": {
|
||||
"commandName": "WSL2",
|
||||
"distributionName": ""
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia.Controls;
|
||||
using nxDumpFuse.ViewModels.Interfaces;
|
||||
|
||||
|
@ -15,14 +16,18 @@ namespace nxDumpFuse.Services
|
|||
|
||||
public async Task<string> ShowOpenFileDialogAsync(string title, FileDialogFilter filter)
|
||||
{
|
||||
var openFileDialog = new OpenFileDialog()
|
||||
var openFileDialog = new OpenFileDialog
|
||||
{
|
||||
Title = title,
|
||||
AllowMultiple = false
|
||||
};
|
||||
openFileDialog.Filters.Add(filter);
|
||||
openFileDialog.Filters!.Add(filter);
|
||||
|
||||
var result = await openFileDialog.ShowAsync(_mainWindowProvider.GetMainWindow());
|
||||
if (result == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
return result.Length == 0 ? string.Empty : result[0];
|
||||
}
|
||||
|
||||
|
@ -32,7 +37,8 @@ namespace nxDumpFuse.Services
|
|||
{
|
||||
Title = title
|
||||
};
|
||||
return await openFolderDialog.ShowAsync(_mainWindowProvider.GetMainWindow());
|
||||
var result = await openFolderDialog.ShowAsync(_mainWindowProvider.GetMainWindow());
|
||||
return result ?? string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ namespace nxDumpFuse.ViewModels
|
|||
public ReactiveCommand<Unit, Unit> StopCommand { get; }
|
||||
|
||||
private bool _isBusy;
|
||||
|
||||
public bool IsBusy
|
||||
{
|
||||
get => _isBusy;
|
||||
|
@ -62,6 +63,7 @@ namespace nxDumpFuse.ViewModels
|
|||
}
|
||||
|
||||
private string _inputFilePath = string.Empty;
|
||||
|
||||
public string InputFilePath
|
||||
{
|
||||
get => _inputFilePath;
|
||||
|
@ -69,6 +71,7 @@ namespace nxDumpFuse.ViewModels
|
|||
}
|
||||
|
||||
private string _outputDir = string.Empty;
|
||||
|
||||
public string OutputDir
|
||||
{
|
||||
get => _outputDir;
|
||||
|
@ -76,6 +79,7 @@ namespace nxDumpFuse.ViewModels
|
|||
}
|
||||
|
||||
private string _progressPartText = string.Empty;
|
||||
|
||||
public string ProgressPartText
|
||||
{
|
||||
get => _progressPartText;
|
||||
|
@ -83,6 +87,7 @@ namespace nxDumpFuse.ViewModels
|
|||
}
|
||||
|
||||
private double _progressPart;
|
||||
|
||||
public double ProgressPart
|
||||
{
|
||||
get => _progressPart;
|
||||
|
@ -90,6 +95,7 @@ namespace nxDumpFuse.ViewModels
|
|||
}
|
||||
|
||||
private double _progress;
|
||||
|
||||
public double Progress
|
||||
{
|
||||
get => _progress;
|
||||
|
@ -97,6 +103,7 @@ namespace nxDumpFuse.ViewModels
|
|||
}
|
||||
|
||||
private string _progressText = string.Empty;
|
||||
|
||||
public string ProgressText
|
||||
{
|
||||
get => _progressText;
|
||||
|
@ -104,6 +111,7 @@ namespace nxDumpFuse.ViewModels
|
|||
}
|
||||
|
||||
private ObservableCollection<FuseSimpleLog> _logItems = new();
|
||||
|
||||
public ObservableCollection<FuseSimpleLog> LogItems
|
||||
{
|
||||
get => _logItems;
|
||||
|
@ -143,7 +151,7 @@ namespace nxDumpFuse.ViewModels
|
|||
private async void SelectInputFile()
|
||||
{
|
||||
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()
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<SelfContained>true</SelfContained>
|
||||
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
|
||||
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
|
||||
<!--<RuntimeIdentifier>linux-x64</RuntimeIdentifier>-->
|
||||
<!-- <RuntimeIdentifier>linux-x64</RuntimeIdentifier> -->
|
||||
<!--<RuntimeIdentifier>osx-x64</RuntimeIdentifier>-->
|
||||
<PublishSingleFile>true</PublishSingleFile>
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
|
@ -22,12 +22,12 @@
|
|||
<EmbeddedResource Include="Assets\github_icon.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="0.10.8" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="0.10.8" />
|
||||
<PackageReference Include="Avalonia.Controls.DataGrid" Version="0.10.8" />
|
||||
<PackageReference Include="Avalonia" Version="0.10.18" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="0.10.18" />
|
||||
<PackageReference Include="Avalonia.Controls.DataGrid" Version="0.10.18" />
|
||||
<!--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 Include="Avalonia.ReactiveUI" Version="0.10.8" />
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.18" />
|
||||
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.18" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="Views\AboutView.axaml.cs">
|
||||
|
|
Loading…
Reference in a new issue