refactor(主题): 将主题相关逻辑提取到ThemeHelper类中

This commit is contained in:
2026-05-01 22:05:30 +08:00
parent 8c7eeb51d0
commit 41a59136c7
5 changed files with 10 additions and 11 deletions
+2 -2
View File
@@ -1212,7 +1212,7 @@ namespace Ink_Canvas
SetTheme("Dark");
break;
case 2: // 跟随系统
if (IsSystemThemeLight())
if (ThemeHelper.IsSystemThemeLight())
{
ThemeManager.Current.ApplicationTheme = ApplicationTheme.Light;
SetTheme("Light");
@@ -3265,7 +3265,7 @@ namespace Ink_Canvas
ViewboxFloatingBar.Opacity = 1.0;
break;
case 2: // 跟随系统
if (IsSystemThemeLight())
if (ThemeHelper.IsSystemThemeLight())
{
SetTheme("Light", true);
ViewboxFloatingBar.Opacity = 1.0;
+2 -2
View File
@@ -1,5 +1,5 @@
using iNKORE.UI.WPF.Modern;
using Ink_Canvas.Helpers;
using iNKORE.UI.WPF.Modern;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
@@ -153,7 +153,7 @@ namespace Ink_Canvas
private bool IsCurrentThemeDark()
{
return Settings.Appearance.Theme == 1 ||
(Settings.Appearance.Theme == 2 && !IsSystemThemeLight());
(Settings.Appearance.Theme == 2 && !ThemeHelper.IsSystemThemeLight());
}
private void RefreshFloatingBarButtonColors()
@@ -62,7 +62,7 @@ namespace Ink_Canvas
{
// 根据主题选择手势图标和颜色
bool isDarkTheme = Settings.Appearance.Theme == 1 ||
(Settings.Appearance.Theme == 2 && !IsSystemThemeLight());
(Settings.Appearance.Theme == 2 && !ThemeHelper.IsSystemThemeLight());
bool isLightTheme = !isDarkTheme;
string gestureIconPath = isLightTheme ? "/Resources/new-icons/gesture.png" : "/Resources/new-icons/gesture_white.png";
@@ -422,7 +422,7 @@ namespace Ink_Canvas
SymbolIconSelect.Icon.Geometry = Geometry.Parse(GetCorrectIcon("lassoSelect", false));
bool isDarkThemeForButtons = Settings.Appearance.Theme == 1 ||
(Settings.Appearance.Theme == 2 && !IsSystemThemeLight());
(Settings.Appearance.Theme == 2 && !ThemeHelper.IsSystemThemeLight());
if (isDarkThemeForButtons)
{
BoardPen.Background = new SolidColorBrush(Color.FromRgb(42, 42, 42));
@@ -460,7 +460,7 @@ namespace Ink_Canvas
// 根据主题选择高光颜色
Color highlightColor;
bool isDarkTheme = Settings.Appearance.Theme == 1 ||
(Settings.Appearance.Theme == 2 && !IsSystemThemeLight());
(Settings.Appearance.Theme == 2 && !ThemeHelper.IsSystemThemeLight());
if (isDarkTheme)
{
@@ -531,7 +531,7 @@ namespace Ink_Canvas
Cursor_Icon.Icon.Geometry =
Geometry.Parse(GetCorrectIcon("cursor", true));
bool isDarkThemeForCursor = Settings.Appearance.Theme == 1 ||
(Settings.Appearance.Theme == 2 && !IsSystemThemeLight());
(Settings.Appearance.Theme == 2 && !ThemeHelper.IsSystemThemeLight());
if (isDarkThemeForCursor)
{
BoardPen.Background = new SolidColorBrush(Color.FromRgb(42, 42, 42));
@@ -4268,7 +4268,7 @@ namespace Ink_Canvas
Color highlightBackgroundColor;
Color highlightBarColor;
bool isDarkTheme = Settings.Appearance.Theme == 1 ||
(Settings.Appearance.Theme == 2 && !IsSystemThemeLight());
(Settings.Appearance.Theme == 2 && !ThemeHelper.IsSystemThemeLight());
if (isDarkTheme)
{
@@ -1,4 +1,4 @@
using iNKORE.UI.WPF.Modern;
using Ink_Canvas.Helpers;
using Microsoft.Win32;
using System;
using System.Timers;
-1
View File
@@ -5,7 +5,6 @@ using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Animation;
using FontIcon = iNKORE.UI.WPF.Modern.Controls.FontIcon;
using MessageBox = iNKORE.UI.WPF.Modern.Controls.MessageBox;
using NavigationView = iNKORE.UI.WPF.Modern.Controls.NavigationView;
using NavigationViewItem = iNKORE.UI.WPF.Modern.Controls.NavigationViewItem;
using NavigationViewSelectionChangedEventArgs = iNKORE.UI.WPF.Modern.Controls.NavigationViewSelectionChangedEventArgs;