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 391ee38426..344a11850c 100644 --- a/src/MaaWpfGui/Main/VersionUpdateViewModel.cs +++ b/src/MaaWpfGui/Main/VersionUpdateViewModel.cs @@ -22,7 +22,10 @@ using System.Runtime.InteropServices; using System.Text; using System.Text.RegularExpressions; using System.Windows; +using System.Windows.Documents; using MaaWpfGui.Helper; +using Markdig; +using Neo.Markdig.Xaml; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Stylet; @@ -108,6 +111,9 @@ namespace MaaWpfGui } } + public FlowDocument UpdateInfoDoc => MarkdownXaml.ToFlowDocument(UpdateInfo, + new MarkdownPipelineBuilder().UseXamlSupportedExtensions().Build()); + private string _updateUrl; /// @@ -119,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); @@ -954,16 +970,6 @@ namespace MaaWpfGui } } - /// - /// Closes view model. - /// - public void Close() - { - RequestClose(); - /* UpdateTag = string.Empty; */ - /* UpdateInfo = string.Empty; */ - } - /// /// The event handler of opening hyperlink. /// diff --git a/src/MaaWpfGui/Views/VersionUpdateView.xaml b/src/MaaWpfGui/Views/VersionUpdateView.xaml index ac1532a6a0..4ebcb3a7b0 100644 --- a/src/MaaWpfGui/Views/VersionUpdateView.xaml +++ b/src/MaaWpfGui/Views/VersionUpdateView.xaml @@ -5,7 +5,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:maa="clr-namespace:MaaWpfGui.Helper.CustomStyle" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:mdxam="clr-namespace:MdXaml;assembly=MdXaml" + xmlns:mdg="clr-namespace:Neo.Markdig.Xaml;assembly=Neo.Markdig.Xaml" xmlns:s="https://github.com/canton7/Stylet" xmlns:vm="clr-namespace:MaaWpfGui" Title="{DynamicResource VersionUpdated}" @@ -15,9 +15,9 @@ mc:Ignorable="d"> - + - + + TextWrapping="Wrap" VerticalAlignment="Bottom" /> + TextWrapping="Wrap" VerticalAlignment="Bottom" /> - - + Zoom="90" + IsSelectionEnabled="False"> + + + + + + + - - - -