mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-11-06 05:38:35 +01:00
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:
@@ -744,25 +744,36 @@ 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;
|
||||||
|
|
||||||
var result = await MessageBox.Show(
|
_askingAboutSettings = true;
|
||||||
this,
|
try
|
||||||
App.Loc["SettingsFileChanged"],
|
|
||||||
App.Loc["SettingsFileChangedTitle"],
|
|
||||||
MessageBoxButtons.YesNo);
|
|
||||||
if (result)
|
|
||||||
{
|
{
|
||||||
AppServices.Current.SettingsStore.Load();
|
var result = await MessageBox.Show(
|
||||||
SettingsView?.ReloadFromSettings();
|
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()
|
private void RestoreFromSimulator()
|
||||||
|
|||||||
Reference in New Issue
Block a user