Fix issue with save button being disabled.
This commit is contained in:
parent
42a93bfac1
commit
e55e969349
@ -27,6 +27,6 @@
|
|||||||
Margin="5"
|
Margin="5"
|
||||||
Padding="30,3,30,3"
|
Padding="30,3,30,3"
|
||||||
Content="Save"
|
Content="Save"
|
||||||
Command="{Binding SaveButtonAsync}" />
|
Click="Save_Click" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@ -1,11 +1,9 @@
|
|||||||
using Avalonia.Controls;
|
|
||||||
using LibationFileManager;
|
using LibationFileManager;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace LibationAvalonia.Dialogs
|
namespace LibationAvalonia.Dialogs
|
||||||
{
|
{
|
||||||
public partial class LibationFilesDialog : Window
|
public partial class LibationFilesDialog : DialogWindow
|
||||||
{
|
{
|
||||||
private class DirSelectOptions
|
private class DirSelectOptions
|
||||||
{
|
{
|
||||||
@ -18,28 +16,26 @@ namespace LibationAvalonia.Dialogs
|
|||||||
|
|
||||||
public string Directory { get; set; } = Configuration.GetKnownDirectoryPath(Configuration.KnownDirectories.UserProfile);
|
public string Directory { get; set; } = Configuration.GetKnownDirectoryPath(Configuration.KnownDirectories.UserProfile);
|
||||||
}
|
}
|
||||||
private DirSelectOptions dirSelectOptions;
|
|
||||||
|
private readonly DirSelectOptions dirSelectOptions;
|
||||||
public string SelectedDirectory => dirSelectOptions.Directory;
|
public string SelectedDirectory => dirSelectOptions.Directory;
|
||||||
public DialogResult DialogResult { get; private set; }
|
|
||||||
public LibationFilesDialog()
|
public LibationFilesDialog() : base(saveAndRestorePosition: false)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
DataContext = dirSelectOptions = new();
|
DataContext = dirSelectOptions = new();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task SaveButtonAsync()
|
public async void Save_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var libationDir = dirSelectOptions.Directory;
|
if (!System.IO.Directory.Exists(SelectedDirectory))
|
||||||
|
|
||||||
if (!System.IO.Directory.Exists(libationDir))
|
|
||||||
{
|
{
|
||||||
await MessageBox.Show("Not saving change to Libation Files location. This folder does not exist:\r\n" + libationDir, "Folder does not exist", MessageBoxButtons.OK, MessageBoxIcon.Error, saveAndRestorePosition: false);
|
await MessageBox.Show("Not saving change to Libation Files location. This folder does not exist:\r\n" + SelectedDirectory, "Folder does not exist", MessageBoxButtons.OK, MessageBoxIcon.Error, saveAndRestorePosition: false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DialogResult = DialogResult.OK;
|
await SaveAndCloseAsync();
|
||||||
Close(DialogResult);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user