From f8a2444fea254a46d3fe6767eb384964529d90e3 Mon Sep 17 00:00:00 2001 From: Flaky Date: Mon, 11 May 2026 18:37:35 +0100 Subject: [PATCH] forgor to save on dialog --- UI/ViewModels/MainWindowViewModel.cs | 33 +++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/UI/ViewModels/MainWindowViewModel.cs b/UI/ViewModels/MainWindowViewModel.cs index de1e842..6983a05 100644 --- a/UI/ViewModels/MainWindowViewModel.cs +++ b/UI/ViewModels/MainWindowViewModel.cs @@ -217,7 +217,14 @@ public partial class MainWindowViewModel : ViewModelBase if (this.UnsavedChanges) { var userWantsToSave = await this._dialogService.ShowDialog(new UnsavedChangesDialog()); - if (userWantsToSave is null) return; + switch (userWantsToSave) + { + case null: + return; + case true: + this.StartTagSaveCommand.Execute(null); + break; + } } var storageProvider = desktop.MainWindow?.StorageProvider; @@ -250,10 +257,16 @@ public partial class MainWindowViewModel : ViewModelBase if (this.UnsavedChanges) { var userWantsToSave = await this._dialogService.ShowDialog(new UnsavedChangesDialog()); - if (userWantsToSave is null) return; + switch (userWantsToSave) + { + case null: + return; + case true: + this.StartTagSaveCommand.Execute(null); + break; + } } - var storageProvider = desktop.MainWindow?.StorageProvider; if (storageProvider is null) return; @@ -338,8 +351,18 @@ public partial class MainWindowViewModel : ViewModelBase Application.Current?.ApplicationLifetime is not IClassicDesktopStyleApplicationLifetime desktop || desktop.MainWindow is null) return; - var userWantsToSave = await this._dialogService.ShowDialog(new UnsavedCancelDialog()); - if (userWantsToSave is null) return; + if (this.UnsavedChanges) + { + var userWantsToSave = await this._dialogService.ShowDialog(new UnsavedChangesDialog()); + switch (userWantsToSave) + { + case null: + return; + case true: + this.StartTagSaveCommand.Execute(null); + break; + } + } var storageProvider = desktop.MainWindow?.StorageProvider; if (storageProvider is null) return; -- 2.51.2