From b59b026c983ff035ff89a536bb68b37e99213ea9 Mon Sep 17 00:00:00 2001 From: chinboy Date: Mon, 8 Dec 2025 14:49:25 +0800 Subject: [PATCH] Add TimerStatistic And Statistic Controls --- .../DataDisplay/StatisticViewModel.cs | 25 +++ .../Views/DataDisplay/StatisticShowCase.axaml | 13 +- .../DataDisplay/StatisticShowCase.axaml.cs | 10 +- .../Themes/AbstractStatisticTheme.axaml | 57 +++++-- .../Statistic/Themes/StatisticTheme.axaml | 34 ---- .../Themes/TimerStatisticTheme.axaml | 30 ++++ .../Statistic/TimerStatistic.cs | 156 +++++++++++++++++- 7 files changed, 275 insertions(+), 50 deletions(-) diff --git a/controlgallery/AtomUIGallery/ShowCases/ViewModels/DataDisplay/StatisticViewModel.cs b/controlgallery/AtomUIGallery/ShowCases/ViewModels/DataDisplay/StatisticViewModel.cs index 1d59bc207..6051e7d8a 100644 --- a/controlgallery/AtomUIGallery/ShowCases/ViewModels/DataDisplay/StatisticViewModel.cs +++ b/controlgallery/AtomUIGallery/ShowCases/ViewModels/DataDisplay/StatisticViewModel.cs @@ -11,6 +11,31 @@ public class StatisticViewModel : ReactiveObject, IRoutableViewModel public string UrlPathSegment { get; } = ID.ToString(); + + private DateTime _deadline; + + public DateTime Deadline + { + get => _deadline; + set => this.RaiseAndSetIfChanged(ref _deadline, value); + } + + private DateTime _tenSecondsLater; + + public DateTime TenSecondsLater + { + get => _tenSecondsLater; + set => this.RaiseAndSetIfChanged(ref _tenSecondsLater, value); + } + + private DateTime _before; + + public DateTime Before + { + get => _before; + set => this.RaiseAndSetIfChanged(ref _before, value); + } + public StatisticViewModel(IScreen screen) { HostScreen = screen; diff --git a/controlgallery/AtomUIGallery/ShowCases/Views/DataDisplay/StatisticShowCase.axaml b/controlgallery/AtomUIGallery/ShowCases/Views/DataDisplay/StatisticShowCase.axaml index b42f3d2df..996e75685 100644 --- a/controlgallery/AtomUIGallery/ShowCases/Views/DataDisplay/StatisticShowCase.axaml +++ b/controlgallery/AtomUIGallery/ShowCases/Views/DataDisplay/StatisticShowCase.axaml @@ -50,7 +50,7 @@ - + @@ -64,5 +64,16 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/controlgallery/AtomUIGallery/ShowCases/Views/DataDisplay/StatisticShowCase.axaml.cs b/controlgallery/AtomUIGallery/ShowCases/Views/DataDisplay/StatisticShowCase.axaml.cs index 584e12e04..cfa32dfc9 100644 --- a/controlgallery/AtomUIGallery/ShowCases/Views/DataDisplay/StatisticShowCase.axaml.cs +++ b/controlgallery/AtomUIGallery/ShowCases/Views/DataDisplay/StatisticShowCase.axaml.cs @@ -8,7 +8,15 @@ public partial class StatisticShowCase : ReactiveUserControl { public StatisticShowCase() { - this.WhenActivated(disposables => { }); + this.WhenActivated(disposables => + { + if (DataContext is StatisticViewModel viewModel) + { + viewModel.Deadline = DateTime.Now.Add(TimeSpan.FromSeconds(60 * 60 * 24 * 2 + 30)); + viewModel.Before = DateTime.Now.Subtract(TimeSpan.FromSeconds(60 * 60 * 24 * 2 + 30)); + viewModel.TenSecondsLater = DateTime.Now.AddSeconds(10); + } + }); InitializeComponent(); } } \ No newline at end of file diff --git a/src/AtomUI.Desktop.Controls/Statistic/Themes/AbstractStatisticTheme.axaml b/src/AtomUI.Desktop.Controls/Statistic/Themes/AbstractStatisticTheme.axaml index f0a5aaf08..b270c757c 100644 --- a/src/AtomUI.Desktop.Controls/Statistic/Themes/AbstractStatisticTheme.axaml +++ b/src/AtomUI.Desktop.Controls/Statistic/Themes/AbstractStatisticTheme.axaml @@ -4,21 +4,56 @@ xmlns:atom="https://atomui.net" x:Class="AtomUI.Desktop.Controls.Themes.AbstractStatisticTheme" x:ClassModifier="internal"> - + + + + + + + + + + + + + + + + + - - - - + + + + \ No newline at end of file diff --git a/src/AtomUI.Desktop.Controls/Statistic/Themes/StatisticTheme.axaml b/src/AtomUI.Desktop.Controls/Statistic/Themes/StatisticTheme.axaml index 5b80db4ef..2b366c87a 100644 --- a/src/AtomUI.Desktop.Controls/Statistic/Themes/StatisticTheme.axaml +++ b/src/AtomUI.Desktop.Controls/Statistic/Themes/StatisticTheme.axaml @@ -7,40 +7,6 @@ - - - - - - - - - - - - - - - -