From 0485307acbbc97dd4968c8cdf384f732ecb0b4a3 Mon Sep 17 00:00:00 2001 From: status102 <102887808+status102@users.noreply.github.com> Date: Thu, 5 Sep 2024 09:13:37 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs | 8 ++++++-- .../UserControl/VersionUpdateSettingsUserControl.xaml | 8 ++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs index c13aa9df44..7446de1519 100755 --- a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs @@ -3638,7 +3638,9 @@ namespace MaaWpfGui.ViewModels.UI private static readonly DateTime _buildDateTime = Assembly.GetExecutingAssembly().GetCustomAttribute()?.BuildDateTime ?? DateTime.MinValue; - public DateTime BuildDateTime { get; } = _buildDateTime; + public static DateTime BuildDateTime => _buildDateTime.ToLocalTime(); + + public static string BuildDateTimeLong => BuildDateTime.ToString("yyyy-MM-dd HH:mm"); private static (DateTime DateTime, string VersionName) _resourceInfo = GetResourceVersionByClientType(ConfigurationHelper.GetValue(ConfigurationKeys.ClientType, string.Empty)); @@ -3661,6 +3663,8 @@ namespace MaaWpfGui.ViewModels.UI set => SetAndNotify(ref _resourceDateTime, value); } + public string ResourceDateTimeLong => ResourceDateTime.ToString("yyyy-MM-dd HH:mm"); + private static (DateTime DateTime, string VersionName) GetResourceVersionByClientType(string clientType) { const string OfficialClientType = "Official"; @@ -4629,7 +4633,7 @@ namespace MaaWpfGui.ViewModels.UI ? LocalizationHelper.DefaultLanguage switch { "en-us" => $" - {ResourceDateTime:dd/MM} {ResourceVersion}", - _ => $" - {ResourceVersion}{ResourceDateTime:#ddMM}", + _ => $" - {ResourceVersion}{ResourceDateTime:#MMdd}", } : string.Empty; rvm.WindowTitle = $"{prefix}MAA{currentConfiguration} - {CoreVersion}{resourceVersion}{connectConfigName}{connectAddress}{clientName}"; diff --git a/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml b/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml index f1782eb032..383da37443 100755 --- a/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml +++ b/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml @@ -126,9 +126,9 @@ Margin="0,5" HorizontalAlignment="Center" VerticalAlignment="Center" - hc:FloatingBlock.Content="{Binding ResourceDateTime}" + hc:FloatingBlock.Content="{Binding ResourceDateTimeLong}" PreviewMouseDown="ResourceVersionClick" - Status="{Binding ResourceDateTime, Mode=OneWay}" + Status="{Binding ResourceDateTimeLong, Mode=OneWay}" Subject="资源日期" Color="#6969AA" /> @@ -211,9 +211,9 @@ Margin="0,5" HorizontalAlignment="Center" VerticalAlignment="Center" - hc:FloatingBlock.Content="{Binding BuildDateTime}" + hc:FloatingBlock.Content="{Binding BuildDateTimeLong}" PreviewMouseDown="CoreVersionClick" - Status="{Binding BuildDateTime, Mode=OneWay}" + Status="{Binding BuildDateTimeLong, Mode=OneWay}" Subject="构建日期" Color="#6969AA" />