diff --git a/src/MaaWpfGui/Main/RootViewModel.cs b/src/MaaWpfGui/Main/RootViewModel.cs index 5c5f18680c..4f190a8bf0 100644 --- a/src/MaaWpfGui/Main/RootViewModel.cs +++ b/src/MaaWpfGui/Main/RootViewModel.cs @@ -85,6 +85,7 @@ namespace MaaWpfGui { if (_versionUpdateViewModel.IsFirstBootAfterUpdate) { + _versionUpdateViewModel.IsFirstBootAfterUpdate = false; _windowManager.ShowWindow(_versionUpdateViewModel); } else @@ -93,6 +94,7 @@ namespace MaaWpfGui if (ret == VersionUpdateViewModel.CheckUpdateRetT.OK) { + _versionUpdateViewModel.IsFirstBootAfterUpdate = true; _versionUpdateViewModel.AskToRestart(); } } diff --git a/src/MaaWpfGui/Main/VersionUpdateViewModel.cs b/src/MaaWpfGui/Main/VersionUpdateViewModel.cs index 01f03d8d67..344a11850c 100644 --- a/src/MaaWpfGui/Main/VersionUpdateViewModel.cs +++ b/src/MaaWpfGui/Main/VersionUpdateViewModel.cs @@ -125,10 +125,20 @@ namespace MaaWpfGui set => SetAndNotify(ref _updateUrl, value); } + private bool _isFirstBootAfterUpdate = Convert.ToBoolean(ViewStatusStorage.Get("VersionUpdate.isfirstboot", bool.FalseString)); + /// - /// Gets a value indicating whether it is the first boot after updating. + /// Gets or sets a value indicating whether it is the first boot after updating. /// - public bool IsFirstBootAfterUpdate => UpdateTag != string.Empty && UpdateTag == _curVersion; + public bool IsFirstBootAfterUpdate + { + get => _isFirstBootAfterUpdate; + set + { + SetAndNotify(ref _isFirstBootAfterUpdate, value); + ViewStatusStorage.Set("VersionUpdate.isfirstboot", value.ToString()); + } + } private string _updatePackageName = ViewStatusStorage.Get("VersionUpdate.package", string.Empty); @@ -960,16 +970,6 @@ namespace MaaWpfGui } } - /// - /// Closes view model. - /// - public void Close() - { - RequestClose(); - /* UpdateTag = string.Empty; */ - /* UpdateInfo = string.Empty; */ - } - /// /// The event handler of opening hyperlink. ///