From 97358acea6750ca53b5e8aca5ffe4ef96c2a642b Mon Sep 17 00:00:00 2001 From: zzyyyl Date: Sun, 5 Mar 2023 17:52:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=20IsFirstBootAfterUp?= =?UTF-8?q?date=20=E7=9A=84=E5=A4=84=E7=90=86=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更新完设成 True,弹完窗设成 False --- src/MaaWpfGui/Main/RootViewModel.cs | 2 ++ src/MaaWpfGui/Main/VersionUpdateViewModel.cs | 24 ++++++++++---------- 2 files changed, 14 insertions(+), 12 deletions(-) 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. ///