From 829a3e7a3d8225f4d7b8c66333d81bd80d4b8273 Mon Sep 17 00:00:00 2001 From: maj00r Date: Mon, 16 Nov 2026 01:20:36 +0100 Subject: [PATCH] fix(start): discarding unsaved settings lets go of the page's edits only, a failed key save starts nothing - the page shows the settings as held again, not read from the file as Restore does, so what other pages set and not yet saved (the depot's filters, the window maximized) stays - the start goes on only once nothing is left to be saved, the keys' file included --- StarterNG/MainWindow.axaml.cs | 5 +++-- StarterNG/Views/Settings.axaml.cs | 17 +++++++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/StarterNG/MainWindow.axaml.cs b/StarterNG/MainWindow.axaml.cs index f978000..6f75ceb 100644 --- a/StarterNG/MainWindow.axaml.cs +++ b/StarterNG/MainWindow.axaml.cs @@ -619,11 +619,12 @@ public partial class MainWindow : Window if (save is null) return; if (save == false) - SettingsView.DiscardChanges(); + SettingsView.DiscardEdits(); else { SettingsView.Save(); - if (AppServices.Current.SettingsStore.LastSaveFailed) + // eu07.ini or the keys' file not written: still there to be saved + if (SettingsView.HasUnsavedChanges) { await MessageBox.Show(this, App.Loc["SettingsNotSaved"], App.Loc["UnsavedChanges"], MessageBoxButtons.Ok); diff --git a/StarterNG/Views/Settings.axaml.cs b/StarterNG/Views/Settings.axaml.cs index c47af0d..0b9e00d 100644 --- a/StarterNG/Views/Settings.axaml.cs +++ b/StarterNG/Views/Settings.axaml.cs @@ -1151,10 +1151,7 @@ public partial class Settings : UserControl, ISettingsCapture ThumbnailSizeChanged?.Invoke(); } - private void ResetButton_OnClick(object? sender, RoutedEventArgs e) => DiscardChanges(); - - /// The edits not saved let go, the page and the keys as the files have them: "Przywróć". - public void DiscardChanges() + private void ResetButton_OnClick(object? sender, RoutedEventArgs e) { AppServices.Current.SettingsStore.Load(); ApplyToUi(); @@ -1164,6 +1161,18 @@ public partial class Settings : UserControl, ISettingsCapture UpdateSaveState(); } + /// + /// The page's own edits let go, and the keys': the page shows the settings as held. Not read again from the file + /// as "Restore" does - what other pages set and not yet saved (a filter of the depot, the window maximized) stays. + /// + public void DiscardEdits() + { + ApplyToUi(); + _keyBindings.Reload(); + _dirty = false; + UpdateSaveState(); + } + /// The list as has it for the monitors there are now, with the size selected. private void SelectResolution(int width, int height) {