Warn before software closed; fix bug on first run

Also put settings into proper dir
This commit is contained in:
2026-02-24 19:38:20 +09:00
parent bc5ce3e311
commit 2a8bbf76bf
14 changed files with 268 additions and 21 deletions
+14
View File
@@ -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;
}
}
}
}