From 36bf1122c6b668e62983392805f2f03ff1cdbab4 Mon Sep 17 00:00:00 2001 From: CJKmkp <2564608840@qq.com> Date: Sat, 4 Oct 2025 22:04:24 +0800 Subject: [PATCH] =?UTF-8?q?improve:=E4=B8=BB=E9=A2=98=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ink Canvas/Resources/Styles/Dark.xaml | 4 ++ Ink Canvas/Resources/Styles/Light.xaml | 4 ++ Ink Canvas/Windows/CountdownTimerWindow.xaml | 4 +- .../Windows/CountdownTimerWindow.xaml.cs | 61 ++++++++++++++++--- 4 files changed, 63 insertions(+), 10 deletions(-) diff --git a/Ink Canvas/Resources/Styles/Dark.xaml b/Ink Canvas/Resources/Styles/Dark.xaml index cf7caa06..5bfa83e2 100644 --- a/Ink Canvas/Resources/Styles/Dark.xaml +++ b/Ink Canvas/Resources/Styles/Dark.xaml @@ -81,6 +81,7 @@ + @@ -92,6 +93,9 @@ + + + diff --git a/Ink Canvas/Resources/Styles/Light.xaml b/Ink Canvas/Resources/Styles/Light.xaml index a62365a4..61d16a7a 100644 --- a/Ink Canvas/Resources/Styles/Light.xaml +++ b/Ink Canvas/Resources/Styles/Light.xaml @@ -81,6 +81,7 @@ + @@ -92,6 +93,9 @@ + + + diff --git a/Ink Canvas/Windows/CountdownTimerWindow.xaml b/Ink Canvas/Windows/CountdownTimerWindow.xaml index 0a2c3f87..093f416b 100644 --- a/Ink Canvas/Windows/CountdownTimerWindow.xaml +++ b/Ink Canvas/Windows/CountdownTimerWindow.xaml @@ -12,7 +12,7 @@ Title="Ink Canvas 画板 - 计时器" Height="700" Width="1100"> - + @@ -171,7 +171,7 @@ Height="18" CornerRadius="9" VerticalAlignment="Center" HorizontalAlignment="Center"> - + diff --git a/Ink Canvas/Windows/CountdownTimerWindow.xaml.cs b/Ink Canvas/Windows/CountdownTimerWindow.xaml.cs index 7e8f9505..4f662605 100644 --- a/Ink Canvas/Windows/CountdownTimerWindow.xaml.cs +++ b/Ink Canvas/Windows/CountdownTimerWindow.xaml.cs @@ -69,7 +69,15 @@ namespace Ink_Canvas isTimerRunning = false; SymbolIconStart.Symbol = iNKORE.UI.WPF.Modern.Controls.Symbol.Play; BtnStartCover.Visibility = Visibility.Visible; - TextBlockHour.Foreground = new SolidColorBrush(StringToColor("#FF5B5D5F")); + var textForeground = Application.Current.FindResource("TimerWindowTextForeground") as SolidColorBrush; + if (textForeground != null) + { + TextBlockHour.Foreground = textForeground; + } + else + { + TextBlockHour.Foreground = new SolidColorBrush(StringToColor("#FF5B5D5F")); + } BorderStopTime.Visibility = Visibility.Collapsed; } }); @@ -103,17 +111,34 @@ namespace Ink_Canvas private void Grid_MouseUp(object sender, MouseButtonEventArgs e) { if (isTimerRunning) return; + + var textForeground = Application.Current.FindResource("TimerWindowTextForeground") as SolidColorBrush; + if (ProcessBarTime.Visibility == Visibility.Visible && isTimerRunning == false) { ProcessBarTime.Visibility = Visibility.Collapsed; GridAdjustHour.Visibility = Visibility.Visible; - TextBlockHour.Foreground = Brushes.Black; + if (textForeground != null) + { + TextBlockHour.Foreground = textForeground; + } + else + { + TextBlockHour.Foreground = Brushes.Black; + } } else { ProcessBarTime.Visibility = Visibility.Visible; GridAdjustHour.Visibility = Visibility.Collapsed; - TextBlockHour.Foreground = new SolidColorBrush(StringToColor("#FF5B5D5F")); + if (textForeground != null) + { + TextBlockHour.Foreground = textForeground; + } + else + { + TextBlockHour.Foreground = new SolidColorBrush(StringToColor("#FF5B5D5F")); + } if (hour == 0 && minute == 0 && second == 0) { @@ -238,7 +263,11 @@ namespace Ink_Canvas BtnResetCover.Visibility = Visibility.Visible; BtnStartCover.Visibility = Visibility.Collapsed; BorderStopTime.Visibility = Visibility.Collapsed; - TextBlockHour.Foreground = new SolidColorBrush(StringToColor("#FF5B5D5F")); + var textForeground3 = Application.Current.FindResource("TimerWindowTextForeground") as SolidColorBrush; + if (textForeground3 != null) + TextBlockHour.Foreground = textForeground3; + else + TextBlockHour.Foreground = new SolidColorBrush(StringToColor("#FF5B5D5F")); } else if (isTimerRunning && isPaused) { @@ -248,7 +277,11 @@ namespace Ink_Canvas BtnResetCover.Visibility = Visibility.Visible; BtnStartCover.Visibility = Visibility.Collapsed; BorderStopTime.Visibility = Visibility.Collapsed; - TextBlockHour.Foreground = new SolidColorBrush(StringToColor("#FF5B5D5F")); + var textForeground3 = Application.Current.FindResource("TimerWindowTextForeground") as SolidColorBrush; + if (textForeground3 != null) + TextBlockHour.Foreground = textForeground3; + else + TextBlockHour.Foreground = new SolidColorBrush(StringToColor("#FF5B5D5F")); SymbolIconStart.Symbol = iNKORE.UI.WPF.Modern.Controls.Symbol.Play; isTimerRunning = false; timer.Stop(); @@ -298,7 +331,11 @@ namespace Ink_Canvas //继续 startTime += DateTime.Now - pauseTime; ProcessBarTime.IsPaused = false; - TextBlockHour.Foreground = Brushes.Black; + var textForeground1 = Application.Current.FindResource("TimerWindowTextForeground") as SolidColorBrush; + if (textForeground1 != null) + TextBlockHour.Foreground = textForeground1; + else + TextBlockHour.Foreground = Brushes.Black; SymbolIconStart.Symbol = iNKORE.UI.WPF.Modern.Controls.Symbol.Pause; isPaused = false; timer.Start(); @@ -310,7 +347,11 @@ namespace Ink_Canvas //暂停 pauseTime = DateTime.Now; ProcessBarTime.IsPaused = true; - TextBlockHour.Foreground = new SolidColorBrush(StringToColor("#FF5B5D5F")); + var textForeground3 = Application.Current.FindResource("TimerWindowTextForeground") as SolidColorBrush; + if (textForeground3 != null) + TextBlockHour.Foreground = textForeground3; + else + TextBlockHour.Foreground = new SolidColorBrush(StringToColor("#FF5B5D5F")); SymbolIconStart.Symbol = iNKORE.UI.WPF.Modern.Controls.Symbol.Play; BorderStopTime.Visibility = Visibility.Collapsed; isPaused = true; @@ -322,7 +363,11 @@ namespace Ink_Canvas startTime = DateTime.Now; totalSeconds = ((hour * 60) + minute) * 60 + second; ProcessBarTime.IsPaused = false; - TextBlockHour.Foreground = Brushes.Black; + var textForeground2 = Application.Current.FindResource("TimerWindowTextForeground") as SolidColorBrush; + if (textForeground2 != null) + TextBlockHour.Foreground = textForeground2; + else + TextBlockHour.Foreground = Brushes.Black; SymbolIconStart.Symbol = iNKORE.UI.WPF.Modern.Controls.Symbol.Pause; BtnResetCover.Visibility = Visibility.Collapsed;