Warn before software closed; fix bug on first run
Also put settings into proper dir
This commit is contained in:
@@ -3,6 +3,7 @@ using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using MayShow.ViewModels;
|
||||
|
||||
namespace MayShow.Views
|
||||
{
|
||||
@@ -12,6 +13,7 @@ namespace MayShow.Views
|
||||
{
|
||||
this.InitializeComponent();
|
||||
LogBlock.PropertyChanged += LogBlock_PropertyChanged;
|
||||
FilesGrid.CellEditEnded += FileCellEditEnded;
|
||||
}
|
||||
|
||||
private void LogBlock_PropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e)
|
||||
@@ -26,6 +28,18 @@ namespace MayShow.Views
|
||||
{
|
||||
var topLevel = TopLevel.GetTopLevel(this);
|
||||
topLevel?.FocusManager?.ClearFocus();
|
||||
if (DataContext is MainViewModel mvm)
|
||||
{
|
||||
mvm?.HasUnsavedWork = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void FileCellEditEnded(object? sender, DataGridCellEditEndedEventArgs args)
|
||||
{
|
||||
if (args.EditAction == DataGridEditAction.Commit && DataContext is MainViewModel mvm)
|
||||
{
|
||||
mvm?.HasUnsavedWork = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user