From e45e20b4492c1d51308723a48c1a7d4a240fd619 Mon Sep 17 00:00:00 2001 From: denglihong2007 <2639367181@qq.com> Date: Wed, 5 Mar 2025 23:56:38 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E6=94=B9=E8=BF=9B=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=98=BE=E7=A4=BA=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CRSim/ViewModels/Windows/ScreenViewModel.cs | 10 ++-------- .../ChengduDong/SecondaryScreenView.xaml | 3 ++- .../GuangdongIntercity/SecondaryScreenView.xaml | 16 +++++++++++++++- .../Stations/Guangyuan/PrimaryScreenView.xaml | 6 ++++-- .../Stations/Harbin/PrimaryScreenView.xaml | 3 ++- 5 files changed, 25 insertions(+), 13 deletions(-) diff --git a/CRSim/ViewModels/Windows/ScreenViewModel.cs b/CRSim/ViewModels/Windows/ScreenViewModel.cs index 6c24227..5001f1b 100644 --- a/CRSim/ViewModels/Windows/ScreenViewModel.cs +++ b/CRSim/ViewModels/Windows/ScreenViewModel.cs @@ -10,11 +10,7 @@ namespace CRSim.ViewModels public readonly Settings _settings; private readonly TaskCompletionSource _dataLoaded = new(); [ObservableProperty] - private string _currentTime; - [ObservableProperty] - private string _currentDate; - [ObservableProperty] - private string _currentSecond; + private DateTime _currentTime = new(); [ObservableProperty] private string _text = ""; [ObservableProperty] @@ -51,9 +47,7 @@ namespace CRSim.ViewModels private void OnTimeElapsed(object? sender, EventArgs e) { - CurrentTime = _timeService.GetDateTimeNow().ToString("yyyy-MM-dd HH:mm:ss"); - CurrentDate = _timeService.GetDateTimeNow().ToString("yyyy-MM-dd"); - CurrentSecond = _timeService.GetDateTimeNow().ToString("HH:mm:ss"); + CurrentTime = _timeService.GetDateTimeNow(); } public Task WaitForDataLoadAsync() => _dataLoaded.Task; diff --git a/CRSim/Views/Windows/Stations/ChengduDong/SecondaryScreenView.xaml b/CRSim/Views/Windows/Stations/ChengduDong/SecondaryScreenView.xaml index fee1a99..1c0bca7 100644 --- a/CRSim/Views/Windows/Stations/ChengduDong/SecondaryScreenView.xaml +++ b/CRSim/Views/Windows/Stations/ChengduDong/SecondaryScreenView.xaml @@ -20,6 +20,7 @@ + @@ -404,7 +405,7 @@ + Name="labelTime" Text="{Binding CurrentTime,Converter={StaticResource DateTimeToStringTimeConverter}}"> diff --git a/CRSim/Views/Windows/Stations/GuangdongIntercity/SecondaryScreenView.xaml b/CRSim/Views/Windows/Stations/GuangdongIntercity/SecondaryScreenView.xaml index 435b9ea..d136ab0 100644 --- a/CRSim/Views/Windows/Stations/GuangdongIntercity/SecondaryScreenView.xaml +++ b/CRSim/Views/Windows/Stations/GuangdongIntercity/SecondaryScreenView.xaml @@ -15,6 +15,8 @@ + + + + @@ -130,8 +132,8 @@ - - + + diff --git a/CRSim/Views/Windows/Stations/Harbin/PrimaryScreenView.xaml b/CRSim/Views/Windows/Stations/Harbin/PrimaryScreenView.xaml index f551beb..dd00c5d 100644 --- a/CRSim/Views/Windows/Stations/Harbin/PrimaryScreenView.xaml +++ b/CRSim/Views/Windows/Stations/Harbin/PrimaryScreenView.xaml @@ -14,6 +14,7 @@ +