improve:主题切换

This commit is contained in:
2025-10-04 21:55:55 +08:00
parent eef2a915fa
commit 402f8bb9f9
8 changed files with 224 additions and 78 deletions
@@ -22,6 +22,9 @@ namespace Ink_Canvas
timer.Elapsed += Timer_Elapsed;
timer.Interval = 50;
InitializeUI();
// 应用主题
ApplyTheme();
}
public static Window CreateTimerWindow()
@@ -358,6 +361,25 @@ namespace Ink_Canvas
}
}
private void ApplyTheme()
{
try
{
// 根据主题设置文本颜色
var textForeground = Application.Current.FindResource("TimerWindowTextForeground") as SolidColorBrush;
if (textForeground != null)
{
TextBlockHour.Foreground = textForeground;
TextBlockMinute.Foreground = textForeground;
TextBlockSecond.Foreground = textForeground;
}
}
catch (Exception ex)
{
LogHelper.WriteLogToFile($"应用倒计时窗口主题出错: {ex.Message}", LogHelper.LogType.Error);
}
}
public void RefreshUI()
{
InitializeUI();