From 1f231423f3705e9e63537f8c2f9e6cb86676ce32 Mon Sep 17 00:00:00 2001 From: maj00r Date: Sun, 1 Nov 2026 20:53:59 +0100 Subject: [PATCH] Ask once when the settings file changes The window is activated again as the question closes, before the answer is in, so a changed eu07.ini was asked about three times in a row. --- StarterNG/MainWindow.axaml.cs | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/StarterNG/MainWindow.axaml.cs b/StarterNG/MainWindow.axaml.cs index 81c4747..0ab7b58 100644 --- a/StarterNG/MainWindow.axaml.cs +++ b/StarterNG/MainWindow.axaml.cs @@ -744,25 +744,36 @@ public partial class MainWindow : Window AppServices.Current.Processes.OpenInShell(folder); } + // The window is activated again as the question closes, before the answer is in. + private bool _askingAboutSettings; + private async void CheckExternalSettings() { - if ((DateTime.UtcNow - _openedUtc).TotalSeconds < 3) + if (_askingAboutSettings || (DateTime.UtcNow - _openedUtc).TotalSeconds < 3) return; if (!AppServices.Current.SettingsStore.IsConfigNewerOnDisk()) return; - var result = await MessageBox.Show( - this, - App.Loc["SettingsFileChanged"], - App.Loc["SettingsFileChangedTitle"], - MessageBoxButtons.YesNo); - if (result) + _askingAboutSettings = true; + try { - AppServices.Current.SettingsStore.Load(); - SettingsView?.ReloadFromSettings(); + var result = await MessageBox.Show( + this, + App.Loc["SettingsFileChanged"], + App.Loc["SettingsFileChangedTitle"], + MessageBoxButtons.YesNo); + if (result) + { + AppServices.Current.SettingsStore.Load(); + SettingsView?.ReloadFromSettings(); + } + else + AppServices.Current.SettingsStore.TouchConfigAge(); + } + finally + { + _askingAboutSettings = false; } - else - AppServices.Current.SettingsStore.TouchConfigAge(); } private void RestoreFromSimulator()