diff --git a/Ink Canvas/Helpers/GlobalHotkeyManager.cs b/Ink Canvas/Helpers/GlobalHotkeyManager.cs
index 85cee823..917ee3f8 100644
--- a/Ink Canvas/Helpers/GlobalHotkeyManager.cs
+++ b/Ink Canvas/Helpers/GlobalHotkeyManager.cs
@@ -774,7 +774,7 @@ namespace Ink_Canvas.Helpers
return;
// 检查鼠标是否在当前窗口所在的屏幕上
- var mousePosition = System.Windows.Forms.Control.MousePosition;
+ var mousePosition = Control.MousePosition;
var currentScreen = Screen.FromPoint(mousePosition);
// 无论屏幕是否变化,都检查热键状态
@@ -880,7 +880,7 @@ namespace Ink_Canvas.Helpers
// 策略2:在多屏幕环境下,检查鼠标是否在当前窗口所在的屏幕上
if (_isMultiScreenMode)
{
- var mousePosition = System.Windows.Forms.Control.MousePosition;
+ var mousePosition = Control.MousePosition;
var mouseScreen = Screen.FromPoint(mousePosition);
if (mouseScreen == _currentScreen)
diff --git a/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs b/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs
index 3bf1f1e5..7b4b48e5 100644
--- a/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs
+++ b/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs
@@ -2700,6 +2700,19 @@ namespace Ink_Canvas
public void BtnExit_Click(object sender, RoutedEventArgs e)
{
+ // 如果当前在设置面板中,需要先恢复无焦点模式状态
+ if (BorderSettings.Visibility == Visibility.Visible)
+ {
+ // 如果用户没有在设置中修改无焦点模式,则恢复之前的状态
+ if (!userChangedNoFocusModeInSettings && wasNoFocusModeBeforeSettings)
+ {
+ Settings.Advanced.IsNoFocusMode = true;
+ ToggleSwitchNoFocusMode.IsOn = true;
+ ApplyNoFocusMode();
+ }
+ SaveSettingsToFile();
+ }
+
App.IsAppExitByUser = true;
// 不设置 CloseIsFromButton = true,让它也经过确认流程
Close();
@@ -2707,6 +2720,18 @@ namespace Ink_Canvas
public void BtnRestart_Click(object sender, RoutedEventArgs e)
{
+ if (BorderSettings.Visibility == Visibility.Visible)
+ {
+ // 如果用户没有在设置中修改无焦点模式,则恢复之前的状态
+ if (!userChangedNoFocusModeInSettings && wasNoFocusModeBeforeSettings)
+ {
+ Settings.Advanced.IsNoFocusMode = true;
+ ToggleSwitchNoFocusMode.IsOn = true;
+ ApplyNoFocusMode();
+ }
+ SaveSettingsToFile();
+ }
+
Process.Start(System.Windows.Forms.Application.ExecutablePath, "-m");
App.IsAppExitByUser = true;
// 不设置 CloseIsFromButton = true,让它也经过确认流程
diff --git a/Ink Canvas/Resources/Styles/Dark.xaml b/Ink Canvas/Resources/Styles/Dark.xaml
index e04f7855..3a5f14bb 100644
--- a/Ink Canvas/Resources/Styles/Dark.xaml
+++ b/Ink Canvas/Resources/Styles/Dark.xaml
@@ -29,4 +29,13 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Ink Canvas/Resources/Styles/Light.xaml b/Ink Canvas/Resources/Styles/Light.xaml
index bcf1db1f..00943f56 100644
--- a/Ink Canvas/Resources/Styles/Light.xaml
+++ b/Ink Canvas/Resources/Styles/Light.xaml
@@ -29,4 +29,13 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Ink Canvas/Windows/HasNewUpdateWindow.xaml b/Ink Canvas/Windows/HasNewUpdateWindow.xaml
index 793d028c..bc7620b0 100644
--- a/Ink Canvas/Windows/HasNewUpdateWindow.xaml
+++ b/Ink Canvas/Windows/HasNewUpdateWindow.xaml
@@ -7,61 +7,68 @@
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
xmlns:mdxam="clr-namespace:MdXaml;assembly=MdXaml"
mc:Ignorable="d"
- ui:WindowHelper.UseModernWindowStyle = "False"
+ ui:WindowHelper.UseModernWindowStyle="False"
ui:WindowHelper.SystemBackdropType="Mica"
Title="InkCanvasForClass CE有新版本可用" Height="650" Width="900" ResizeMode="NoResize"
- WindowStartupLocation="CenterScreen" WindowStyle="None" AllowsTransparency="True"
+ WindowStartupLocation="CenterScreen" WindowStyle="None"
Background="Transparent">
-
+
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
+ SelectionChanged="VersionComboBox_SelectionChanged"/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/Ink Canvas/Windows/HistoryRollbackWindow.xaml.cs b/Ink Canvas/Windows/HistoryRollbackWindow.xaml.cs
index cd1668ac..1e402565 100644
--- a/Ink Canvas/Windows/HistoryRollbackWindow.xaml.cs
+++ b/Ink Canvas/Windows/HistoryRollbackWindow.xaml.cs
@@ -1,4 +1,5 @@
using Ink_Canvas.Helpers;
+using iNKORE.UI.WPF.Modern;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -8,6 +9,7 @@ using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
+using System.Windows.Media;
// Added for OrderByDescending
@@ -31,17 +33,117 @@ namespace Ink_Canvas
{
InitializeComponent();
this.channel = channel;
+
+ // 应用当前主题
+ ApplyCurrentTheme();
+
LoadVersions();
// 添加窗口拖动功能
- this.MouseDown += (sender, e) =>
+ MouseDown += (sender, e) =>
{
if (e.ChangedButton == MouseButton.Left)
{
- this.DragMove();
+ DragMove();
}
};
}
+
+ ///
+ /// 应用当前主题设置
+ ///
+ private void ApplyCurrentTheme()
+ {
+ try
+ {
+ // 根据主窗口的主题设置应用主题
+ switch (MainWindow.Settings.Appearance.Theme)
+ {
+ case 0: // 浅色主题
+ ThemeManager.SetRequestedTheme(this, ElementTheme.Light);
+ UpdateColorsForLightTheme();
+ break;
+ case 1: // 深色主题
+ ThemeManager.SetRequestedTheme(this, ElementTheme.Dark);
+ UpdateColorsForDarkTheme();
+ break;
+ case 2: // 跟随系统
+ if (IsSystemThemeLight())
+ {
+ ThemeManager.SetRequestedTheme(this, ElementTheme.Light);
+ UpdateColorsForLightTheme();
+ }
+ else
+ {
+ ThemeManager.SetRequestedTheme(this, ElementTheme.Dark);
+ UpdateColorsForDarkTheme();
+ }
+ break;
+ }
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteLogToFile($"应用主题时出错: {ex.Message}", LogHelper.LogType.Error);
+ }
+ }
+
+ ///
+ /// 更新为浅色主题颜色
+ ///
+ private void UpdateColorsForLightTheme()
+ {
+ try
+ {
+ // 更新主要颜色资源
+ Resources["PrimaryBrush"] = new SolidColorBrush(Color.FromRgb(0x25, 0x63, 0xeb));
+ Resources["TextPrimaryBrush"] = new SolidColorBrush(Color.FromRgb(0x1f, 0x29, 0x37));
+ Resources["TextSecondaryBrush"] = new SolidColorBrush(Color.FromRgb(0x6b, 0x72, 0x80));
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteLogToFile($"更新浅色主题颜色时出错: {ex.Message}", LogHelper.LogType.Error);
+ }
+ }
+
+ ///
+ /// 更新为深色主题颜色
+ ///
+ private void UpdateColorsForDarkTheme()
+ {
+ try
+ {
+ // 更新主要颜色资源
+ Resources["PrimaryBrush"] = new SolidColorBrush(Color.FromRgb(0x3b, 0x82, 0xf6));
+ Resources["TextPrimaryBrush"] = new SolidColorBrush(Color.FromRgb(0xf9, 0xfa, 0xfb));
+ Resources["TextSecondaryBrush"] = new SolidColorBrush(Color.FromRgb(0x9c, 0xa3, 0xaf));
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteLogToFile($"更新深色主题颜色时出错: {ex.Message}", LogHelper.LogType.Error);
+ }
+ }
+
+ ///
+ /// 检查系统是否为浅色主题
+ ///
+ private bool IsSystemThemeLight()
+ {
+ try
+ {
+ using (var key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize"))
+ {
+ if (key?.GetValue("AppsUseLightTheme") is int value)
+ {
+ return value == 1;
+ }
+ }
+ }
+ catch
+ {
+ // 如果无法读取注册表,默认返回true(浅色主题)
+ }
+ return true;
+ }
private async void LoadVersions()
{
@@ -146,12 +248,12 @@ namespace Ink_Canvas
private void MinimizeButton_Click(object sender, RoutedEventArgs e)
{
- this.WindowState = WindowState.Minimized;
+ WindowState = WindowState.Minimized;
}
private void CloseButton_Click(object sender, RoutedEventArgs e)
{
- this.Close();
+ Close();
}
protected override void OnClosing(CancelEventArgs e)