From 0fb5c04debc8668e5bdd60f9612562ae1becee69 Mon Sep 17 00:00:00 2001 From: CJKmkp <2564608840@qq.com> Date: Sat, 10 Jan 2026 17:31:55 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"add:=E6=96=B0=E8=AE=BE=E7=BD=AE"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit fbfac18ca073ae70b2b6fa29b34066d9918dac05. --- .../SettingsViews/AboutPanel.xaml | 18 +- .../SettingsViews/AboutPanel.xaml.cs | 295 +------- .../SettingsViews/AdvancedPanel.xaml | 149 ++-- .../SettingsViews/AdvancedPanel.xaml.cs | 241 ++++--- .../SettingsViews/AppearancePanel.xaml | 48 +- .../SettingsViews/AppearancePanel.xaml.cs | 109 +-- .../SettingsViews/AutomationPanel.xaml | 47 +- .../SettingsViews/AutomationPanel.xaml.cs | 41 +- .../SettingsViews/CanvasAndInkPanel.xaml | 188 +++--- .../SettingsViews/CanvasAndInkPanel.xaml.cs | 244 +++++-- .../SettingsViews/ComboBoxStyles.xaml | 4 +- .../SettingsViews/CrashActionPanel.xaml.cs | 11 +- .../FloatingBarDnDSettingsPanel.xaml.cs | 14 +- .../SettingsViews/GesturesPanel.xaml | 9 +- .../SettingsViews/GesturesPanel.xaml.cs | 102 ++- .../SettingsViews/InkRecognitionPanel.xaml | 28 +- .../SettingsViews/InkRecognitionPanel.xaml.cs | 120 ++-- .../SettingsViews/LuckyRandomPanel.xaml | 21 +- .../SettingsViews/LuckyRandomPanel.xaml.cs | 116 +++- .../SettingsViews/MainWindowSettingsHelper.cs | 239 ++++++- .../SettingsViews/PowerPointPanel.xaml | 76 +-- .../SettingsViews/PowerPointPanel.xaml.cs | 360 ++++------ .../SettingsViews/SearchPanel.xaml | 8 + .../SettingsViews/SearchPanel.xaml.cs | 113 +++- .../SettingsViews/SettingsBaseView.xaml.cs | 12 +- .../SettingsViews/SettingsPanelBase.cs | 71 +- .../SettingsViews/ShortcutsPanel.xaml | 1 + .../SettingsViews/ShortcutsPanel.xaml.cs | 11 +- .../SettingsViews/SnapshotPanel.xaml | 163 ++--- .../SettingsViews/SnapshotPanel.xaml.cs | 296 ++++---- .../SettingsViews/StartupPanel.xaml | 26 +- .../SettingsViews/StartupPanel.xaml.cs | 215 +++++- .../SettingsViews/StoragePanel.xaml | 1 + .../SettingsViews/StoragePanel.xaml.cs | 11 +- .../SettingsViews/ThemeHelper.cs | 638 ++++++++++-------- .../SettingsViews/ThemePanel.xaml | 38 +- .../SettingsViews/ThemePanel.xaml.cs | 175 ++++- .../SettingsViews/TimerPanel.xaml | 23 +- .../SettingsViews/TimerPanel.xaml.cs | 109 ++- .../Windows/SettingsViews/SettingsWindow.xaml | 26 + .../SettingsViews/SettingsWindow.xaml.cs | 192 ++---- 41 files changed, 2615 insertions(+), 1994 deletions(-) diff --git a/Ink Canvas/Windows/SettingsViews/SettingsViews/AboutPanel.xaml b/Ink Canvas/Windows/SettingsViews/SettingsViews/AboutPanel.xaml index a121f9ae..a74ffefa 100644 --- a/Ink Canvas/Windows/SettingsViews/SettingsViews/AboutPanel.xaml +++ b/Ink Canvas/Windows/SettingsViews/SettingsViews/AboutPanel.xaml @@ -73,8 +73,8 @@ - - + + @@ -84,8 +84,8 @@ - - + + @@ -119,7 +119,7 @@ - + @@ -128,7 +128,7 @@ - + @@ -146,7 +146,7 @@ - + @@ -164,7 +164,7 @@ - + @@ -181,7 +181,7 @@ - + diff --git a/Ink Canvas/Windows/SettingsViews/SettingsViews/AboutPanel.xaml.cs b/Ink Canvas/Windows/SettingsViews/SettingsViews/AboutPanel.xaml.cs index bef1d438..ec925479 100644 --- a/Ink Canvas/Windows/SettingsViews/SettingsViews/AboutPanel.xaml.cs +++ b/Ink Canvas/Windows/SettingsViews/SettingsViews/AboutPanel.xaml.cs @@ -1,9 +1,7 @@ using iNKORE.UI.WPF.Helpers; -using Ink_Canvas.Helpers; using OSVersionExtension; using System; using System.Collections.Generic; -using System.Diagnostics; using System.IO; using System.Management; using System.Reflection; @@ -19,14 +17,16 @@ using System.Windows.Media.Imaging; namespace Ink_Canvas.Windows.SettingsViews { + /// + /// AboutPanel.xaml 的交互逻辑 + /// public partial class AboutPanel : UserControl { public AboutPanel() { InitializeComponent(); - Loaded += AboutPanel_Loaded; - + // 关于页面图片横幅 if (File.Exists(App.RootPath + "icc-about-illustrations.png")) { try @@ -42,22 +42,8 @@ namespace Ink_Canvas.Windows.SettingsViews CopyrightBannerImage.Visibility = Visibility.Collapsed; } - try - { - var assembly = Assembly.GetExecutingAssembly(); - var version = assembly.GetName().Version; - var assemblyTitle = assembly.GetCustomAttribute()?.Title ?? "InkCanvasForClass"; - AboutSoftwareVersion.Text = $"{assemblyTitle} v{version.Major}.{version.Minor}.{version.Build}.{version.Revision}"; - } - catch - { - AboutSoftwareVersion.Text = "InkCanvasForClass v1.7.18.0"; - } - - UpdateSystemInfo(); - - // 以下残留代码已移至 UpdateSystemInfo() 方法,应删除 - /* + // 关于页面构建时间 + var buildTime = FileBuildTimeHelper.GetBuildDateTime(Assembly.GetExecutingAssembly()); if (buildTime != null) { var bt = ((DateTimeOffset)buildTime).LocalDateTime; @@ -70,115 +56,18 @@ namespace Ink_Canvas.Windows.SettingsViews $"build-{bt.Year}-{m}-{d}-{h}:{min}:{s}"; } + // 关于页面系统版本 AboutSystemVersion.Text = $"{OSVersion.GetOperatingSystem()} {OSVersion.GetOSVersion().Version}"; + // 关于页面触摸设备 var _t_touch = new Thread(() => { var touchcount = TouchTabletDetectHelper.GetTouchTabletDevices().Count; var support = TouchTabletDetectHelper.IsTouchEnabled(); Dispatcher.BeginInvoke(() => - AboutTouchTabletText.Text = $"{touchcount}���豸��{(support ? "֧�ִ����豸" : "�޴���֧��")}"); + AboutTouchTabletText.Text = $"{touchcount}个设备,{(support ? "支持触摸设备" : "无触摸支持")}"); }); _t_touch.Start(); - */ - - try - { - var assembly = Assembly.GetExecutingAssembly(); - var copyright = assembly.GetCustomAttribute()?.Copyright ?? "? Copyright 2024-2026"; - AboutCopyright.Text = copyright; - - if (AboutBottomCopyright != null) - { - var company = assembly.GetCustomAttribute()?.Company ?? ""; - if (!string.IsNullOrEmpty(company)) - { - AboutBottomCopyright.Text = $"{copyright} {company} ����"; - } - else - { - AboutBottomCopyright.Text = copyright; - } - } - } - catch - { - AboutCopyright.Text = "? Copyright 2024-2026"; - if (AboutBottomCopyright != null) - { - AboutBottomCopyright.Text = "? Copyright 2024-2026"; - } - } - - if (AboutUserCopyright != null) - { - try - { - var deviceId = DeviceIdentifier.GetDeviceId(); - AboutUserCopyright.Text = deviceId; - } - catch - { - AboutUserCopyright.Text = "获取设备ID失败"; - } - } - - SetupLinkClickHandlers(); - - UpdateLinkColors(); - } - - private void SetupLinkClickHandlers() - { - if (AboutOfficialWebsiteLink != null) - { - AboutOfficialWebsiteLink.MouseLeftButtonDown += (s, e) => - { - OpenUrlInBrowser("https://forum.smart-teach.cn/t/icc-ce"); - }; - AboutOfficialWebsiteLink.Cursor = Cursors.Hand; - } - - if (AboutGithubLink != null) - { - AboutGithubLink.MouseLeftButtonDown += (s, e) => - { - OpenUrlInBrowser("https://github.com/InkCanvasForClass/community"); - }; - AboutGithubLink.Cursor = Cursors.Hand; - } - - if (AboutContributorsLink != null) - { - AboutContributorsLink.MouseLeftButtonDown += (s, e) => - { - OpenUrlInBrowser("https://github.com/InkCanvasForClass/community#贡献者"); - }; - AboutContributorsLink.Cursor = Cursors.Hand; - } - } - - private void OpenUrlInBrowser(string url) - { - try - { - Process.Start(new ProcessStartInfo - { - FileName = url, - UseShellExecute = true - }); - } - catch (Exception ex) - { - try - { - Process.Start("cmd", $"/c start {url}"); - } - catch - { - System.Diagnostics.Debug.WriteLine($"�޷�������: {url}, ����: {ex.Message}"); - } - } } public static class TouchTabletDetectHelper @@ -254,8 +143,8 @@ namespace Ink_Canvas.Windows.SettingsViews { fileStream.Position = 0x3C; fileStream.Read(buffer, 0, 4); - fileStream.Position = BitConverter.ToUInt32(buffer, 0); - fileStream.Read(buffer, 0, 4); + fileStream.Position = BitConverter.ToUInt32(buffer, 0); // COFF header offset + fileStream.Read(buffer, 0, 4); // "PE\0\0" fileStream.Read(buffer, 0, buffer.Length); } var pinnedBuffer = GCHandle.Alloc(buffer, GCHandleType.Pinned); @@ -370,171 +259,19 @@ namespace Ink_Canvas.Windows.SettingsViews var border = thumb.Template.FindName("ScrollbarThumbEx", thumb); ((Border)border).Background = new SolidColorBrush(Color.FromRgb(138, 138, 138)); } + + /// + /// 应用主题 + /// public void ApplyTheme() { try { ThemeHelper.ApplyThemeToControl(this); - UpdateLinkColors(); } catch (Exception ex) { - System.Diagnostics.Debug.WriteLine($"AboutPanel Ӧ������ʱ����: {ex.Message}"); - } - } - - private void UpdateLinkColors() - { - var linkColor = ThemeHelper.IsDarkTheme - ? Color.FromRgb(96, 205, 255) - : Color.FromRgb(29, 78, 216); - - if (AboutOfficialWebsiteLink != null) - { - AboutOfficialWebsiteLink.Foreground = new SolidColorBrush(linkColor); - } - if (AboutGithubLink != null) - { - AboutGithubLink.Foreground = new SolidColorBrush(linkColor); - } - if (AboutContributorsLink != null) - { - AboutContributorsLink.Foreground = new SolidColorBrush(linkColor); - } - } - - private void AboutPanel_Loaded(object sender, RoutedEventArgs e) - { - UpdateSystemInfo(); - } - - private void UpdateSystemInfo() - { - UpdateUpdateIconVisibility(); - - try - { - AboutSystemVersion.Text = $"{OSVersion.GetOperatingSystem()} {OSVersion.GetOSVersion().Version}"; - } - catch - { - AboutSystemVersion.Text = "未知系统版本"; - } - - try - { - var buildTime = FileBuildTimeHelper.GetBuildDateTime(Assembly.GetExecutingAssembly()); - if (buildTime != null) - { - var bt = ((DateTimeOffset)buildTime).LocalDateTime; - var m = bt.Month.ToString().PadLeft(2, '0'); - var d = bt.Day.ToString().PadLeft(2, '0'); - var h = bt.Hour.ToString().PadLeft(2, '0'); - var min = bt.Minute.ToString().PadLeft(2, '0'); - var s = bt.Second.ToString().PadLeft(2, '0'); - AboutBuildTime.Text = $"build-{bt.Year}-{m}-{d}-{h}:{min}:{s}"; - } - } - catch - { - AboutBuildTime.Text = "build-未知"; - } - - var _t_touch = new Thread(() => - { - try - { - var touchcount = TouchTabletDetectHelper.GetTouchTabletDevices().Count; - var support = TouchTabletDetectHelper.IsTouchEnabled(); - Dispatcher.BeginInvoke(() => - AboutTouchTabletText.Text = $"{touchcount}个设备,{(support ? "支持触摸设备" : "无触摸支持")}"); - } - catch - { - Dispatcher.BeginInvoke(() => - AboutTouchTabletText.Text = "检测失败"); - } - }); - _t_touch.Start(); - - try - { - if (AboutUserCopyright != null) - { - var deviceId = DeviceIdentifier.GetDeviceId(); - AboutUserCopyright.Text = deviceId; - } - } - catch - { - if (AboutUserCopyright != null) - { - AboutUserCopyright.Text = "获取设备ID失败"; - } - } - } - - private void UpdateUpdateIconVisibility() - { - try - { - if (UpdateAvailableIcon != null) - { - bool hasUpdate = false; - try - { - var mainWindow = Application.Current.MainWindow as MainWindow; - if (mainWindow != null) - { - var hasNewUpdateProperty = mainWindow.GetType().GetProperty("HasNewUpdate"); - if (hasNewUpdateProperty != null) - { - hasUpdate = (bool)(hasNewUpdateProperty.GetValue(mainWindow) ?? false); - } - else - { - var updateInfoProperty = mainWindow.GetType().GetProperty("UpdateInfo"); - if (updateInfoProperty != null) - { - var updateInfo = updateInfoProperty.GetValue(mainWindow); - if (updateInfo != null) - { - var hasUpdateProperty = updateInfo.GetType().GetProperty("HasUpdate"); - if (hasUpdateProperty != null) - { - hasUpdate = (bool)(hasUpdateProperty.GetValue(updateInfo) ?? false); - } - } - } - } - } - } - catch - { - try - { - var mainWindow = Application.Current.MainWindow as MainWindow; - if (mainWindow != null) - { - var hasUpdateProperty = mainWindow.GetType().GetProperty("HasUpdate"); - if (hasUpdateProperty != null) - { - hasUpdate = (bool)(hasUpdateProperty.GetValue(mainWindow) ?? false); - } - } - } - catch { } - } - - UpdateAvailableIcon.Visibility = hasUpdate ? Visibility.Visible : Visibility.Collapsed; - } - } - catch - { - if (UpdateAvailableIcon != null) - { - UpdateAvailableIcon.Visibility = Visibility.Collapsed; - } + System.Diagnostics.Debug.WriteLine($"AboutPanel 应用主题时出错: {ex.Message}"); } } } diff --git a/Ink Canvas/Windows/SettingsViews/SettingsViews/AdvancedPanel.xaml b/Ink Canvas/Windows/SettingsViews/SettingsViews/AdvancedPanel.xaml index e5002f37..0f7d72cf 100644 --- a/Ink Canvas/Windows/SettingsViews/SettingsViews/AdvancedPanel.xaml +++ b/Ink Canvas/Windows/SettingsViews/SettingsViews/AdvancedPanel.xaml @@ -12,6 +12,7 @@ + +