From fad5e27a87616e297c2e8df4f9e8a2f65e04798f Mon Sep 17 00:00:00 2001 From: clover_yan <56215525+clover-yan@users.noreply.github.com> Date: Tue, 9 May 2023 21:33:40 +0800 Subject: [PATCH] Final Version --- DateCountdown/MainWindow.xaml.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DateCountdown/MainWindow.xaml.cs b/DateCountdown/MainWindow.xaml.cs index 3bc076c..feb0c77 100644 --- a/DateCountdown/MainWindow.xaml.cs +++ b/DateCountdown/MainWindow.xaml.cs @@ -46,12 +46,12 @@ private void DispatcherTimer_Tick(object sender, EventArgs e) // { // timeSpan = new DateTime(year, 6, 8, 17, 0, 0) - DateTime.Now; // } - TextBlockDays.Text = ((detailNum < 0.0) && neg ? "-" : "") + Math.Abs(timeSpan.Days).ToString(); + double detailNum = (timeSpan.Hours * 3600000 + timeSpan.Minutes * 60000 + timeSpan.Seconds * 1000 + timeSpan.Milliseconds) / 86400000.0; + TextBlockDays.Text = ((detailNum < 0.0) && neg ? "-" + Math.Abs(timeSpan.Days).ToString() : Math.Abs(timeSpan.Days).ToString()); if (redText || ((!greenText) && (timeSpan.Days < 100))) { TextBlockDays.Foreground = Brushes.Red; } - double detailNum = (timeSpan.Hours * 3600000 + timeSpan.Minutes * 60000 + timeSpan.Seconds * 1000 + timeSpan.Milliseconds) / 86400000.0; string detailStr = Math.Abs(detailNum).ToString(StringFormat); if (detailStr.StartsWith("1.")) {