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.
This commit is contained in:
maj00r
2026-11-01 20:53:59 +01:00
parent b60c176533
commit 1f231423f3

View File

@@ -744,13 +744,19 @@ public partial class MainWindow : Window
AppServices.Current.Processes.OpenInShell(folder); 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() private async void CheckExternalSettings()
{ {
if ((DateTime.UtcNow - _openedUtc).TotalSeconds < 3) if (_askingAboutSettings || (DateTime.UtcNow - _openedUtc).TotalSeconds < 3)
return; return;
if (!AppServices.Current.SettingsStore.IsConfigNewerOnDisk()) if (!AppServices.Current.SettingsStore.IsConfigNewerOnDisk())
return; return;
_askingAboutSettings = true;
try
{
var result = await MessageBox.Show( var result = await MessageBox.Show(
this, this,
App.Loc["SettingsFileChanged"], App.Loc["SettingsFileChanged"],
@@ -764,6 +770,11 @@ public partial class MainWindow : Window
else else
AppServices.Current.SettingsStore.TouchConfigAge(); AppServices.Current.SettingsStore.TouchConfigAge();
} }
finally
{
_askingAboutSettings = false;
}
}
private void RestoreFromSimulator() private void RestoreFromSimulator()
{ {