improve:主题切换

This commit is contained in:
2025-10-04 22:04:24 +08:00
parent 402f8bb9f9
commit 36bf1122c6
4 changed files with 63 additions and 10 deletions
+4
View File
@@ -81,6 +81,7 @@
<SolidColorBrush x:Key="RandWindowCloseButtonBackground" Color="#E32A34"/>
<SolidColorBrush x:Key="RandWindowCloseButtonForeground" Color="White"/>
<!-- 倒计时窗口主题颜色 -->
<SolidColorBrush x:Key="TimerWindowBackground" Color="#1f1f1f"/>
<SolidColorBrush x:Key="TimerWindowBorderBrush" Color="#0066BF"/>
@@ -92,6 +93,9 @@
<SolidColorBrush x:Key="TimerWindowStopTimeBackground" Color="#2a2a2a"/>
<SolidColorBrush x:Key="TimerWindowStopTimeForeground" Color="White"/>
<!-- 倒计时窗口时钟图标 -->
<BitmapImage x:Key="TimerWindowClockIcon" UriSource="/Resources/Icons-Fluent/ic_fluent_timer_24_regular-light.png"/>
<!-- 倒计时窗口主题颜色 -->
<SolidColorBrush x:Key="SeewoTimerWindowBackground" Color="#1f1f1f"/>
<SolidColorBrush x:Key="SeewoTimerWindowBorderBrush" Color="#E0E0E0"/>
+4
View File
@@ -81,6 +81,7 @@
<SolidColorBrush x:Key="RandWindowCloseButtonBackground" Color="#E32A34"/>
<SolidColorBrush x:Key="RandWindowCloseButtonForeground" Color="White"/>
<!-- 倒计时窗口主题颜色 -->
<SolidColorBrush x:Key="TimerWindowBackground" Color="#F0F3F9"/>
<SolidColorBrush x:Key="TimerWindowBorderBrush" Color="#0066BF"/>
@@ -92,6 +93,9 @@
<SolidColorBrush x:Key="TimerWindowStopTimeBackground" Color="#E8EAF0"/>
<SolidColorBrush x:Key="TimerWindowStopTimeForeground" Color="Black"/>
<!-- 倒计时窗口时钟图标 -->
<BitmapImage x:Key="TimerWindowClockIcon" UriSource="/Resources/Icons-Fluent/ic_fluent_timer_24_regular.png"/>
<!-- 倒计时窗口主题颜色 -->
<SolidColorBrush x:Key="SeewoTimerWindowBackground" Color="White"/>
<SolidColorBrush x:Key="SeewoTimerWindowBorderBrush" Color="#E0E0E0"/>
+2 -2
View File
@@ -12,7 +12,7 @@
Title="Ink Canvas 画板 - 计时器" Height="700" Width="1100">
<Border Background="{DynamicResource TimerWindowBackground}" CornerRadius="10" BorderThickness="1" BorderBrush="{DynamicResource TimerWindowBorderBrush}" Margin="60">
<Grid>
<TextBlock x:Name="TbCurrentTime" MouseDown="BtnMinimal_OnMouseUp" Visibility="Collapsed" FontSize="56" FontWeight="Black" HorizontalAlignment="Center" VerticalAlignment="Center" />
<TextBlock x:Name="TbCurrentTime" MouseDown="BtnMinimal_OnMouseUp" Visibility="Collapsed" FontSize="56" FontWeight="Black" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{DynamicResource TimerWindowTextForeground}" />
<Border MouseMove="WindowDragMove" Visibility="{Binding ElementName=TbCurrentTime, Path=Visibility}" Width="64" Height="15" CornerRadius="8" Background="Gray" Margin="0,0,0,5" HorizontalAlignment="Center" VerticalAlignment="Bottom" />
<Viewbox x:Name="BigViewController" Margin="20,20,20,20">
<Grid Height="180" Width="200">
@@ -171,7 +171,7 @@
Height="18" CornerRadius="9"
VerticalAlignment="Center" HorizontalAlignment="Center">
<ui:SimpleStackPanel Margin="6,0" Spacing="0" Orientation="Horizontal" HorizontalAlignment="Center">
<Image Margin="0,0,2,0" Source="/Resources/Icons-Fluent/ic_fluent_clock_24_regular.png" RenderOptions.BitmapScalingMode="HighQuality" Height="10" Width="10"/>
<Image Margin="0,0,2,0" Source="{DynamicResource TimerWindowClockIcon}" RenderOptions.BitmapScalingMode="HighQuality" Height="10" Width="10"/>
<TextBlock Name="TextBlockStopTime" Text="12:30 PM" FontSize="9" VerticalAlignment="Center" Foreground="{DynamicResource TimerWindowStopTimeForeground}"/>
</ui:SimpleStackPanel>
</Border>
@@ -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;