From b9651240df1398e036db92854284b23330f94752 Mon Sep 17 00:00:00 2001
From: PrefacedCorg <1876568293@qq.com>
Date: Fri, 24 Apr 2026 19:16:48 +0800
Subject: [PATCH] =?UTF-8?q?feat(=E8=AE=BE=E7=BD=AE):=20=E6=B7=BB=E5=8A=A0?=
=?UTF-8?q?=E5=AE=9E=E9=AA=8C=E6=80=A7=E9=80=89=E9=A1=B9=E9=A1=B5=E9=9D=A2?=
=?UTF-8?q?=E5=B9=B6=E4=BC=98=E5=8C=96=E5=9B=BE=E6=A0=87=E6=98=BE=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
添加新的实验性选项页面,将高级设置中的实验性功能移至该页面
优化设置页面中图标的显示,支持自定义字体
为外部协议调用和避免全屏助手添加设置项
默认启用避免全屏助手功能
---
Ink Canvas/MainWindow.xaml | 201 ------------------
Ink Canvas/MainWindow_cs/MW_Settings.cs | 107 +---------
Ink Canvas/MainWindow_cs/MW_SettingsToLoad.cs | 7 -
Ink Canvas/Properties/Strings.en-US.resx | 6 +
Ink Canvas/Properties/Strings.resx | 6 +
Ink Canvas/Resources/Settings.cs | 2 +-
.../SettingsViews/Pages/BasicPage.xaml | 2 +-
.../SettingsViews/Pages/BasicPage.xaml.cs | 41 +++-
.../SettingsViews/Pages/ExperimentalPage.xaml | 74 +++++++
.../Pages/ExperimentalPage.xaml.cs | 135 ++++++++++++
.../Windows/SettingsViews/Pages/HomePage.xaml | 2 +-
.../SettingsViews/Pages/HomePage.xaml.cs | 41 +++-
.../Pages/MainInterfacePage.xaml | 2 +-
.../Pages/MainInterfacePage.xaml.cs | 40 +++-
.../SettingsViews/Pages/StartupPage.xaml | 8 +
.../SettingsViews/Pages/StartupPage.xaml.cs | 54 +++++
.../SettingsViews/Pages/WindowPage.xaml | 7 +
.../SettingsViews/Pages/WindowPage.xaml.cs | 30 +++
.../Windows/SettingsViews/SettingsWindow.xaml | 12 ++
.../SettingsViews/SettingsWindow.xaml.cs | 1 +
20 files changed, 439 insertions(+), 339 deletions(-)
create mode 100644 Ink Canvas/Windows/SettingsViews/Pages/ExperimentalPage.xaml
create mode 100644 Ink Canvas/Windows/SettingsViews/Pages/ExperimentalPage.xaml.cs
diff --git a/Ink Canvas/MainWindow.xaml b/Ink Canvas/MainWindow.xaml
index ba26217a..10a77f89 100644
--- a/Ink Canvas/MainWindow.xaml
+++ b/Ink Canvas/MainWindow.xaml
@@ -1897,8 +1897,6 @@
-
@@ -1966,205 +1964,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Ink Canvas/MainWindow_cs/MW_Settings.cs b/Ink Canvas/MainWindow_cs/MW_Settings.cs
index 6061f90e..d5285998 100644
--- a/Ink Canvas/MainWindow_cs/MW_Settings.cs
+++ b/Ink Canvas/MainWindow_cs/MW_Settings.cs
@@ -2885,7 +2885,7 @@ namespace Ink_Canvas
Settings.Advanced.IsEnableEdgeGestureUtil = false;
Settings.Advanced.EdgeGestureUtilOnlyAffectBlackboardMode = false;
Settings.Advanced.IsEnableFullScreenHelper = false;
- Settings.Advanced.IsEnableAvoidFullScreenHelper = false;
+ Settings.Advanced.IsEnableAvoidFullScreenHelper = true;
Settings.Advanced.IsEnableForceFullScreen = false;
Settings.Advanced.IsEnableDPIChangeDetection = false;
Settings.Advanced.IsEnableResolutionChangeDetection = false;
@@ -3076,60 +3076,6 @@ namespace Ink_Canvas
SaveSettingsToFile();
}
- private void ToggleSwitchIsEnableUriScheme_Toggled(object sender, RoutedEventArgs e)
- {
- if (!isLoaded) return;
-
- bool newState = ToggleSwitchIsEnableUriScheme.IsOn;
- bool success = false;
-
- try
- {
- if (newState)
- {
- if (!UriSchemeHelper.IsUriSchemeRegistered())
- {
- success = UriSchemeHelper.RegisterUriScheme();
- }
- else
- {
- success = true;
- }
- }
- else
- {
- if (UriSchemeHelper.IsUriSchemeRegistered())
- {
- success = UriSchemeHelper.UnregisterUriScheme();
- }
- else
- {
- success = true;
- }
- }
- }
- catch (Exception ex)
- {
- LogHelper.WriteLogToFile($"切换URI Scheme状态失败: {ex.Message}", LogHelper.LogType.Error);
- success = false;
- }
-
- if (success)
- {
- Settings.Advanced.IsEnableUriScheme = newState;
- SaveSettingsToFile();
- }
- else
- {
- // 回滚 UI 状态
- isLoaded = false;
- ToggleSwitchIsEnableUriScheme.IsOn = !newState;
- isLoaded = true;
-
- ShowNotification("设置外部协议失败,请检查权限或日志");
- }
- }
-
private void TouchMultiplierSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
{
if (!isLoaded) return;
@@ -3147,57 +3093,6 @@ namespace Ink_Canvas
TextBlockShowCalculatedMultiplier.Text = (5 / (value * 1.1)).ToString();
}
- private void ToggleSwitchIsEnableFullScreenHelper_Toggled(object sender, RoutedEventArgs e)
- {
- if (!isLoaded) return;
- Settings.Advanced.IsEnableFullScreenHelper = ToggleSwitchIsEnableFullScreenHelper.IsOn;
- SaveSettingsToFile();
- }
-
- private void ToggleSwitchIsEnableAvoidFullScreenHelper_OnToggled(object sender, RoutedEventArgs e)
- {
- if (!isLoaded) return;
- Settings.Advanced.IsEnableAvoidFullScreenHelper = ToggleSwitchIsEnableAvoidFullScreenHelper.IsOn;
- SaveSettingsToFile();
- if (ToggleSwitchIsEnableAvoidFullScreenHelper.IsOn)
- {
- AvoidFullScreenHelper.StartAvoidFullScreen(this);
- }
- else
- {
- AvoidFullScreenHelper.StopAvoidFullScreen(this);
- }
- }
-
- private void ToggleSwitchIsEnableEdgeGestureUtil_Toggled(object sender, RoutedEventArgs e)
- {
- if (!isLoaded) return;
- Settings.Advanced.IsEnableEdgeGestureUtil = ToggleSwitchIsEnableEdgeGestureUtil.IsOn;
- if (OSVersion.GetOperatingSystem() >= OperatingSystem.Windows10) EdgeGestureUtil.DisableEdgeGestures(new WindowInteropHelper(this).Handle, ToggleSwitchIsEnableEdgeGestureUtil.IsOn);
- SaveSettingsToFile();
- }
-
- private void ToggleSwitchIsEnableForceFullScreen_Toggled(object sender, RoutedEventArgs e)
- {
- if (!isLoaded) return;
- Settings.Advanced.IsEnableForceFullScreen = ToggleSwitchIsEnableForceFullScreen.IsOn;
- SaveSettingsToFile();
- }
-
- private void ToggleSwitchIsEnableDPIChangeDetection_Toggled(object sender, RoutedEventArgs e)
- {
- if (!isLoaded) return;
- Settings.Advanced.IsEnableDPIChangeDetection = ToggleSwitchIsEnableDPIChangeDetection.IsOn;
- SaveSettingsToFile();
- }
-
- private void ToggleSwitchIsEnableResolutionChangeDetection_Toggled(object sender, RoutedEventArgs e)
- {
- if (!isLoaded) return;
- Settings.Advanced.IsEnableResolutionChangeDetection = ToggleSwitchIsEnableResolutionChangeDetection.IsOn;
- SaveSettingsToFile();
- }
-
private void ToggleSwitchEraserBindTouchMultiplier_Toggled(object sender, RoutedEventArgs e)
{
if (!isLoaded) return;
diff --git a/Ink Canvas/MainWindow_cs/MW_SettingsToLoad.cs b/Ink Canvas/MainWindow_cs/MW_SettingsToLoad.cs
index 1a4cecd6..402f042a 100644
--- a/Ink Canvas/MainWindow_cs/MW_SettingsToLoad.cs
+++ b/Ink Canvas/MainWindow_cs/MW_SettingsToLoad.cs
@@ -872,15 +872,8 @@ namespace Ink_Canvas
ToggleSwitchIsSaveLogByDate.IsOn = Settings.Advanced.IsSaveLogByDate;
ToggleSwitchIsSecondConfimeWhenShutdownApp.IsOn = Settings.Advanced.IsSecondConfirmWhenShutdownApp;
ToggleSwitchIsSpecialScreen.IsOn = Settings.Advanced.IsSpecialScreen;
- ToggleSwitchIsEnableUriScheme.IsOn = Settings.Advanced.IsEnableUriScheme;
ToggleSwitchIsQuadIR.IsOn = Settings.Advanced.IsQuadIR;
ToggleSwitchEraserBindTouchMultiplier.IsOn = Settings.Advanced.EraserBindTouchMultiplier;
- ToggleSwitchIsEnableFullScreenHelper.IsOn = Settings.Advanced.IsEnableFullScreenHelper;
- ToggleSwitchIsEnableEdgeGestureUtil.IsOn = Settings.Advanced.IsEnableEdgeGestureUtil;
- ToggleSwitchIsEnableForceFullScreen.IsOn = Settings.Advanced.IsEnableForceFullScreen;
- ToggleSwitchIsEnableResolutionChangeDetection.IsOn = Settings.Advanced.IsEnableResolutionChangeDetection;
- ToggleSwitchIsEnableDPIChangeDetection.IsOn = Settings.Advanced.IsEnableDPIChangeDetection;
- ToggleSwitchIsEnableAvoidFullScreenHelper.IsOn = Settings.Advanced.IsEnableAvoidFullScreenHelper;
ToggleSwitchIsAutoBackupBeforeUpdate.IsOn = Settings.Advanced.IsAutoBackupBeforeUpdate;
ToggleSwitchIsAutoBackupEnabled.IsOn = Settings.Advanced.IsAutoBackupEnabled;
diff --git a/Ink Canvas/Properties/Strings.en-US.resx b/Ink Canvas/Properties/Strings.en-US.resx
index f281967a..b3925094 100644
--- a/Ink Canvas/Properties/Strings.en-US.resx
+++ b/Ink Canvas/Properties/Strings.en-US.resx
@@ -981,6 +981,12 @@
Dock to sidebar after startup
+
+ External protocol (icc://)
+
+
+ Control via icc:// protocol
+
Canvas and ink
diff --git a/Ink Canvas/Properties/Strings.resx b/Ink Canvas/Properties/Strings.resx
index 2cc5b89a..06222a0f 100644
--- a/Ink Canvas/Properties/Strings.resx
+++ b/Ink Canvas/Properties/Strings.resx
@@ -1023,6 +1023,12 @@
开机运行后收纳到侧边栏
+
+ 外部协议调用 (icc://)
+
+
+ 通过 icc:// 协议从外部控制软件
+
画板和墨迹
diff --git a/Ink Canvas/Resources/Settings.cs b/Ink Canvas/Resources/Settings.cs
index 4f3baec5..de4bd12d 100644
--- a/Ink Canvas/Resources/Settings.cs
+++ b/Ink Canvas/Resources/Settings.cs
@@ -703,7 +703,7 @@ namespace Ink_Canvas
public bool IsSecondConfirmWhenShutdownApp { get; set; }
[JsonProperty("isEnableAvoidFullScreenHelper")]
- public bool IsEnableAvoidFullScreenHelper { get; set; }
+ public bool IsEnableAvoidFullScreenHelper { get; set; } = true;
[JsonProperty("isAutoBackupBeforeUpdate")]
public bool IsAutoBackupBeforeUpdate { get; set; } = true;
diff --git a/Ink Canvas/Windows/SettingsViews/Pages/BasicPage.xaml b/Ink Canvas/Windows/SettingsViews/Pages/BasicPage.xaml
index a95ed041..4c1eb914 100644
--- a/Ink Canvas/Windows/SettingsViews/Pages/BasicPage.xaml
+++ b/Ink Canvas/Windows/SettingsViews/Pages/BasicPage.xaml
@@ -45,7 +45,7 @@
Click="SubPageCard_Click"
Tag="{Binding PageTag}">
-
+
diff --git a/Ink Canvas/Windows/SettingsViews/Pages/BasicPage.xaml.cs b/Ink Canvas/Windows/SettingsViews/Pages/BasicPage.xaml.cs
index 713355c0..de09d950 100644
--- a/Ink Canvas/Windows/SettingsViews/Pages/BasicPage.xaml.cs
+++ b/Ink Canvas/Windows/SettingsViews/Pages/BasicPage.xaml.cs
@@ -1,6 +1,9 @@
+using iNKORE.UI.WPF.Modern.Common.IconKeys;
using iNKORE.UI.WPF.Modern.Controls;
using System.Collections.ObjectModel;
+using System.Reflection;
using System.Windows;
+using System.Windows.Media;
using SWC = System.Windows.Controls;
namespace Ink_Canvas.Windows.SettingsViews.Pages
@@ -11,6 +14,7 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
public string Description { get; set; }
public string PageTag { get; set; }
public string IconGlyph { get; set; }
+ public FontFamily IconFontFamily { get; set; }
}
public partial class BasicPage : SWC.Page
@@ -53,7 +57,7 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
string childTag = childItem.Tag as string;
if (!string.IsNullOrEmpty(childTag))
{
- string glyph = ExtractIconGlyph(childItem);
+ (string glyph, FontFamily fontFamily) = ExtractIconInfo(childItem);
string description = SWC.ToolTipService.GetToolTip(childItem) as string
?? $"点击跳转到{childItem.Content}";
@@ -62,7 +66,8 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
Header = childItem.Content?.ToString() ?? "",
Description = description,
PageTag = childTag,
- IconGlyph = glyph
+ IconGlyph = glyph,
+ IconFontFamily = fontFamily
});
}
}
@@ -73,15 +78,39 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
}
}
- private string ExtractIconGlyph(NavigationViewItem navItem)
+ private (string glyph, FontFamily fontFamily) ExtractIconInfo(NavigationViewItem navItem)
{
if (navItem.Icon is FontIcon fontIcon)
- return fontIcon.Glyph ?? "\uE713";
+ {
+ string glyph = fontIcon.Glyph ?? "\uE713";
+ FontFamily fontFamily = fontIcon.FontFamily ?? new FontFamily("Segoe Fluent Icons");
+
+ if (fontIcon.Icon != null)
+ {
+ string iconStr = fontIcon.Icon.ToString();
+ if (iconStr.Contains("_20_"))
+ {
+ string key24 = iconStr.Replace("_20_", "_24_");
+ var field = typeof(FluentSystemIcons).GetField(key24, BindingFlags.Public | BindingFlags.Static);
+ if (field != null)
+ {
+ var value = field.GetValue(null);
+ if (value is FontIconData data24)
+ {
+ glyph = data24.Glyph ?? glyph;
+ fontFamily = data24.FontFamily ?? fontFamily;
+ }
+ }
+ }
+ }
+
+ return (glyph, fontFamily);
+ }
if (navItem.Icon is SymbolIcon symbolIcon)
- return char.ConvertFromUtf32((int)symbolIcon.Symbol);
+ return (char.ConvertFromUtf32((int)symbolIcon.Symbol), new FontFamily("Segoe Fluent Icons"));
- return "\uE713";
+ return ("\uE713", new FontFamily("Segoe Fluent Icons"));
}
private void SubPageCard_Click(object sender, RoutedEventArgs e)
diff --git a/Ink Canvas/Windows/SettingsViews/Pages/ExperimentalPage.xaml b/Ink Canvas/Windows/SettingsViews/Pages/ExperimentalPage.xaml
new file mode 100644
index 00000000..a12e53a3
--- /dev/null
+++ b/Ink Canvas/Windows/SettingsViews/Pages/ExperimentalPage.xaml
@@ -0,0 +1,74 @@
+
+
+
+
+
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Ink Canvas/Windows/SettingsViews/Pages/ExperimentalPage.xaml.cs b/Ink Canvas/Windows/SettingsViews/Pages/ExperimentalPage.xaml.cs
new file mode 100644
index 00000000..28b8a8ea
--- /dev/null
+++ b/Ink Canvas/Windows/SettingsViews/Pages/ExperimentalPage.xaml.cs
@@ -0,0 +1,135 @@
+using Ink_Canvas.Helpers;
+using Ink_Canvas.Windows.SettingsViews.Helpers;
+using OSVersionExtension;
+using System;
+using System.Diagnostics;
+using System.Windows;
+
+namespace Ink_Canvas.Windows.SettingsViews.Pages
+{
+ public partial class ExperimentalPage : iNKORE.UI.WPF.Modern.Controls.Page
+ {
+ private bool _isLoaded = false;
+
+ public ExperimentalPage()
+ {
+ InitializeComponent();
+ Loaded += ExperimentalPage_Loaded;
+ }
+
+ private void ExperimentalPage_Loaded(object sender, RoutedEventArgs e)
+ {
+ LoadSettings();
+ _isLoaded = true;
+ }
+
+ private void LoadSettings()
+ {
+ _isLoaded = false;
+
+ try
+ {
+ var settings = SettingsManager.Settings;
+ if (settings.Advanced != null)
+ {
+ CardFullScreenHelper.IsOn = settings.Advanced.IsEnableFullScreenHelper;
+ CardEdgeGestureUtil.IsOn = settings.Advanced.IsEnableEdgeGestureUtil;
+ CardForceFullScreen.IsOn = settings.Advanced.IsEnableForceFullScreen;
+ CardDPIChangeDetection.IsOn = settings.Advanced.IsEnableDPIChangeDetection;
+ CardResolutionChangeDetection.IsOn = settings.Advanced.IsEnableResolutionChangeDetection;
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine($"加载实验性选项时出错: {ex.Message}");
+ }
+
+ _isLoaded = true;
+ }
+
+ private void ToggleSwitchFullScreenHelper_Toggled(object sender, RoutedEventArgs e)
+ {
+ if (!_isLoaded) return;
+
+ try
+ {
+ SettingsManager.Settings.Advanced.IsEnableFullScreenHelper = CardFullScreenHelper.IsOn;
+ SettingsManager.SaveSettingsToFile();
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine($"设置全屏助手时出错: {ex.Message}");
+ }
+ }
+
+ private void ToggleSwitchEdgeGestureUtil_Toggled(object sender, RoutedEventArgs e)
+ {
+ if (!_isLoaded) return;
+
+ try
+ {
+ SettingsManager.Settings.Advanced.IsEnableEdgeGestureUtil = CardEdgeGestureUtil.IsOn;
+ SettingsManager.SaveSettingsToFile();
+
+ if (OSVersion.GetOperatingSystem() >= OSVersionExtension.OperatingSystem.Windows10)
+ {
+ var window = Application.Current.MainWindow;
+ if (window != null)
+ {
+ var handle = new System.Windows.Interop.WindowInteropHelper(window).Handle;
+ EdgeGestureUtil.DisableEdgeGestures(handle, CardEdgeGestureUtil.IsOn);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine($"设置边缘手势时出错: {ex.Message}");
+ }
+ }
+
+ private void ToggleSwitchForceFullScreen_Toggled(object sender, RoutedEventArgs e)
+ {
+ if (!_isLoaded) return;
+
+ try
+ {
+ SettingsManager.Settings.Advanced.IsEnableForceFullScreen = CardForceFullScreen.IsOn;
+ SettingsManager.SaveSettingsToFile();
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine($"设置强制全屏时出错: {ex.Message}");
+ }
+ }
+
+ private void ToggleSwitchDPIChangeDetection_Toggled(object sender, RoutedEventArgs e)
+ {
+ if (!_isLoaded) return;
+
+ try
+ {
+ SettingsManager.Settings.Advanced.IsEnableDPIChangeDetection = CardDPIChangeDetection.IsOn;
+ SettingsManager.SaveSettingsToFile();
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine($"设置DPI变化检测时出错: {ex.Message}");
+ }
+ }
+
+ private void ToggleSwitchResolutionChangeDetection_Toggled(object sender, RoutedEventArgs e)
+ {
+ if (!_isLoaded) return;
+
+ try
+ {
+ SettingsManager.Settings.Advanced.IsEnableResolutionChangeDetection = CardResolutionChangeDetection.IsOn;
+ SettingsManager.SaveSettingsToFile();
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine($"设置分辨率变化检测时出错: {ex.Message}");
+ }
+ }
+ }
+}
diff --git a/Ink Canvas/Windows/SettingsViews/Pages/HomePage.xaml b/Ink Canvas/Windows/SettingsViews/Pages/HomePage.xaml
index 9e1eb00f..6c43e434 100644
--- a/Ink Canvas/Windows/SettingsViews/Pages/HomePage.xaml
+++ b/Ink Canvas/Windows/SettingsViews/Pages/HomePage.xaml
@@ -45,7 +45,7 @@
Click="QuickNavCard_Click"
Tag="{Binding PageTag}">
-
+
diff --git a/Ink Canvas/Windows/SettingsViews/Pages/HomePage.xaml.cs b/Ink Canvas/Windows/SettingsViews/Pages/HomePage.xaml.cs
index f31f2c94..a3041fdb 100644
--- a/Ink Canvas/Windows/SettingsViews/Pages/HomePage.xaml.cs
+++ b/Ink Canvas/Windows/SettingsViews/Pages/HomePage.xaml.cs
@@ -1,6 +1,7 @@
using iNKORE.UI.WPF.Modern.Common.IconKeys;
using iNKORE.UI.WPF.Modern.Controls;
using System.Collections.ObjectModel;
+using System.Reflection;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
@@ -13,6 +14,7 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
public string Description { get; set; }
public string PageTag { get; set; }
public string IconGlyph { get; set; }
+ public FontFamily IconFontFamily { get; set; }
}
public partial class HomePage
@@ -54,8 +56,8 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
string tag = navItem.Tag as string;
if (!string.IsNullOrEmpty(tag) && tag != "HomePage")
{
- string glyph = ExtractIconGlyph(navItem);
- string description = System.Windows.Controls.ToolTipService.GetToolTip(navItem) as string
+ (string glyph, FontFamily fontFamily) = ExtractIconInfo(navItem);
+ string description = ToolTipService.GetToolTip(navItem) as string
?? $"点击跳转到{navItem.Content}";
_navItems.Add(new QuickNavItem
@@ -63,26 +65,47 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
Header = navItem.Content?.ToString() ?? "",
Description = description,
PageTag = tag,
- IconGlyph = glyph
+ IconGlyph = glyph,
+ IconFontFamily = fontFamily
});
}
}
}
}
- private string ExtractIconGlyph(NavigationViewItem navItem)
+ private (string glyph, FontFamily fontFamily) ExtractIconInfo(NavigationViewItem navItem)
{
if (navItem.Icon is FontIcon fontIcon)
{
- return fontIcon.Glyph ?? "\uE713";
+ string glyph = fontIcon.Glyph ?? "\uE713";
+ FontFamily fontFamily = fontIcon.FontFamily ?? new FontFamily("Segoe Fluent Icons");
+
+ if (fontIcon.Icon != null)
+ {
+ string iconStr = fontIcon.Icon.ToString();
+ if (iconStr.Contains("_20_"))
+ {
+ string key24 = iconStr.Replace("_20_", "_24_");
+ var field = typeof(FluentSystemIcons).GetField(key24, BindingFlags.Public | BindingFlags.Static);
+ if (field != null)
+ {
+ var value = field.GetValue(null);
+ if (value is FontIconData data24)
+ {
+ glyph = data24.Glyph ?? glyph;
+ fontFamily = data24.FontFamily ?? fontFamily;
+ }
+ }
+ }
+ }
+
+ return (glyph, fontFamily);
}
if (navItem.Icon is SymbolIcon symbolIcon)
- {
- return char.ConvertFromUtf32((int)symbolIcon.Symbol);
- }
+ return (char.ConvertFromUtf32((int)symbolIcon.Symbol), new FontFamily("Segoe Fluent Icons"));
- return "\uE713";
+ return ("\uE713", new FontFamily("Segoe Fluent Icons"));
}
private void QuickNavCard_Click(object sender, RoutedEventArgs e)
diff --git a/Ink Canvas/Windows/SettingsViews/Pages/MainInterfacePage.xaml b/Ink Canvas/Windows/SettingsViews/Pages/MainInterfacePage.xaml
index a701a599..0cdee00f 100644
--- a/Ink Canvas/Windows/SettingsViews/Pages/MainInterfacePage.xaml
+++ b/Ink Canvas/Windows/SettingsViews/Pages/MainInterfacePage.xaml
@@ -45,7 +45,7 @@
Click="SubPageCard_Click"
Tag="{Binding PageTag}">
-
+
diff --git a/Ink Canvas/Windows/SettingsViews/Pages/MainInterfacePage.xaml.cs b/Ink Canvas/Windows/SettingsViews/Pages/MainInterfacePage.xaml.cs
index ad450b68..5ccb8287 100644
--- a/Ink Canvas/Windows/SettingsViews/Pages/MainInterfacePage.xaml.cs
+++ b/Ink Canvas/Windows/SettingsViews/Pages/MainInterfacePage.xaml.cs
@@ -1,6 +1,9 @@
+using iNKORE.UI.WPF.Modern.Common.IconKeys;
using iNKORE.UI.WPF.Modern.Controls;
using System.Collections.ObjectModel;
+using System.Reflection;
using System.Windows;
+using System.Windows.Media;
using SWC = System.Windows.Controls;
namespace Ink_Canvas.Windows.SettingsViews.Pages
@@ -45,7 +48,7 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
string childTag = childItem.Tag as string;
if (!string.IsNullOrEmpty(childTag))
{
- string glyph = ExtractIconGlyph(childItem);
+ (string glyph, FontFamily fontFamily) = ExtractIconInfo(childItem);
string description = SWC.ToolTipService.GetToolTip(childItem) as string
?? $"点击跳转到{childItem.Content}";
@@ -54,7 +57,8 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
Header = childItem.Content?.ToString() ?? "",
Description = description,
PageTag = childTag,
- IconGlyph = glyph
+ IconGlyph = glyph,
+ IconFontFamily = fontFamily
});
}
}
@@ -65,15 +69,39 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
}
}
- private string ExtractIconGlyph(NavigationViewItem navItem)
+ private (string glyph, FontFamily fontFamily) ExtractIconInfo(NavigationViewItem navItem)
{
if (navItem.Icon is FontIcon fontIcon)
- return fontIcon.Glyph ?? "\uE737";
+ {
+ string glyph = fontIcon.Glyph ?? "\uE737";
+ FontFamily fontFamily = fontIcon.FontFamily ?? new FontFamily("Segoe Fluent Icons");
+
+ if (fontIcon.Icon != null)
+ {
+ string iconStr = fontIcon.Icon.ToString();
+ if (iconStr.Contains("_20_"))
+ {
+ string key24 = iconStr.Replace("_20_", "_24_");
+ var field = typeof(FluentSystemIcons).GetField(key24, BindingFlags.Public | BindingFlags.Static);
+ if (field != null)
+ {
+ var value = field.GetValue(null);
+ if (value is FontIconData data24)
+ {
+ glyph = data24.Glyph ?? glyph;
+ fontFamily = data24.FontFamily ?? fontFamily;
+ }
+ }
+ }
+ }
+
+ return (glyph, fontFamily);
+ }
if (navItem.Icon is SymbolIcon symbolIcon)
- return char.ConvertFromUtf32((int)symbolIcon.Symbol);
+ return (char.ConvertFromUtf32((int)symbolIcon.Symbol), new FontFamily("Segoe Fluent Icons"));
- return "\uE737";
+ return ("\uE737", new FontFamily("Segoe Fluent Icons"));
}
private void SubPageCard_Click(object sender, RoutedEventArgs e)
diff --git a/Ink Canvas/Windows/SettingsViews/Pages/StartupPage.xaml b/Ink Canvas/Windows/SettingsViews/Pages/StartupPage.xaml
index 7ac3c583..ffac5edd 100644
--- a/Ink Canvas/Windows/SettingsViews/Pages/StartupPage.xaml
+++ b/Ink Canvas/Windows/SettingsViews/Pages/StartupPage.xaml
@@ -50,6 +50,14 @@
SwitchName="ToggleSwitchFoldAtStartup"
Toggled="ToggleSwitchFoldAtStartup_Toggled" />
+
+
+
diff --git a/Ink Canvas/Windows/SettingsViews/Pages/StartupPage.xaml.cs b/Ink Canvas/Windows/SettingsViews/Pages/StartupPage.xaml.cs
index 5812dfd4..e24f70cc 100644
--- a/Ink Canvas/Windows/SettingsViews/Pages/StartupPage.xaml.cs
+++ b/Ink Canvas/Windows/SettingsViews/Pages/StartupPage.xaml.cs
@@ -42,6 +42,8 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
{
CardPPTOnlyMode.IsOn = settings.ModeSettings.IsPPTOnlyMode;
}
+
+ CardExternalProtocol.IsOn = settings.Advanced.IsEnableUriScheme;
}
catch (Exception ex)
{
@@ -95,6 +97,58 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
}
}
+ private void ToggleSwitchExternalProtocol_Toggled(object sender, RoutedEventArgs e)
+ {
+ if (!_isLoaded) return;
+
+ try
+ {
+ bool newState = CardExternalProtocol.IsOn;
+ bool success = false;
+
+ if (newState)
+ {
+ if (!UriSchemeHelper.IsUriSchemeRegistered())
+ {
+ success = UriSchemeHelper.RegisterUriScheme();
+ }
+ else
+ {
+ success = true;
+ }
+ }
+ else
+ {
+ if (UriSchemeHelper.IsUriSchemeRegistered())
+ {
+ success = UriSchemeHelper.UnregisterUriScheme();
+ }
+ else
+ {
+ success = true;
+ }
+ }
+
+ if (success)
+ {
+ SettingsManager.Settings.Advanced.IsEnableUriScheme = newState;
+ SettingsManager.SaveSettingsToFile();
+ }
+ else
+ {
+ _isLoaded = false;
+ CardExternalProtocol.IsOn = !newState;
+ _isLoaded = true;
+
+ LogHelper.WriteLogToFile("设置外部协议失败,请检查权限或日志", LogHelper.LogType.Error);
+ }
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine($"设置外部协议时出错: {ex.Message}");
+ }
+ }
+
#endregion
#region 模式设置事件处理
diff --git a/Ink Canvas/Windows/SettingsViews/Pages/WindowPage.xaml b/Ink Canvas/Windows/SettingsViews/Pages/WindowPage.xaml
index 7340f1ca..8913e8b5 100644
--- a/Ink Canvas/Windows/SettingsViews/Pages/WindowPage.xaml
+++ b/Ink Canvas/Windows/SettingsViews/Pages/WindowPage.xaml
@@ -50,6 +50,13 @@
SwitchName="ToggleSwitchWindowMode"
Toggled="ToggleSwitchWindowMode_Toggled" />
+
+
+
+
+
+
+
+
+
+
diff --git a/Ink Canvas/Windows/SettingsViews/SettingsWindow.xaml.cs b/Ink Canvas/Windows/SettingsViews/SettingsWindow.xaml.cs
index eafbe878..7e462177 100644
--- a/Ink Canvas/Windows/SettingsViews/SettingsWindow.xaml.cs
+++ b/Ink Canvas/Windows/SettingsViews/SettingsWindow.xaml.cs
@@ -43,6 +43,7 @@ namespace Ink_Canvas.Windows.SettingsViews
{ "MainInterfacePage", typeof(MainInterfacePage) },
{ "WindowPage", typeof(WindowPage) },
{ "UpdatePage", typeof(UpdatePage) },
+ { "ExperimentalPage", typeof(ExperimentalPage) },
{ "CanvasPage", typeof(CanvasPage) },
{ "DebugPage", typeof(IconographyPage) },
{ "AboutPage", typeof(AboutPage) },