From 981ca7629e83287f3419f4664310bc16c5e53d8b Mon Sep 17 00:00:00 2001 From: CJKmkp <2564608840@qq.com> Date: Sat, 10 Jan 2026 23:20:31 +0800 Subject: [PATCH] =?UTF-8?q?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 --- .../SettingsViews/SearchPanel.xaml.cs | 3 ++ .../SettingsViews/UpdateCenterPanel.xaml | 18 ++++++++ .../SettingsViews/UpdateCenterPanel.xaml.cs | 44 +++++++++++++++++++ .../Windows/SettingsViews/SettingsWindow.xaml | 12 +++++ .../SettingsViews/SettingsWindow.xaml.cs | 19 +++++++- 5 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 Ink Canvas/Windows/SettingsViews/SettingsViews/UpdateCenterPanel.xaml create mode 100644 Ink Canvas/Windows/SettingsViews/SettingsViews/UpdateCenterPanel.xaml.cs diff --git a/Ink Canvas/Windows/SettingsViews/SettingsViews/SearchPanel.xaml.cs b/Ink Canvas/Windows/SettingsViews/SettingsViews/SearchPanel.xaml.cs index a54b7352..04b1643f 100644 --- a/Ink Canvas/Windows/SettingsViews/SettingsViews/SearchPanel.xaml.cs +++ b/Ink Canvas/Windows/SettingsViews/SettingsViews/SearchPanel.xaml.cs @@ -77,6 +77,9 @@ namespace Ink_Canvas.Windows.SettingsViews // 截图和屏幕捕捉 new SettingItem { Title = "截图和屏幕捕捉", Category = "截图和屏幕捕捉", ItemName = "SnapshotItem", Type = SettingItemType.Category }, + // 更新中心 + new SettingItem { Title = "更新中心", Category = "更新中心", ItemName = "UpdateCenterItem", Type = SettingItemType.Category }, + // 关于 new SettingItem { Title = "关于 InkCanvasForClass", Category = "关于", ItemName = "AboutItem", Type = SettingItemType.Category }, }; diff --git a/Ink Canvas/Windows/SettingsViews/SettingsViews/UpdateCenterPanel.xaml b/Ink Canvas/Windows/SettingsViews/SettingsViews/UpdateCenterPanel.xaml new file mode 100644 index 00000000..cea8de44 --- /dev/null +++ b/Ink Canvas/Windows/SettingsViews/SettingsViews/UpdateCenterPanel.xaml @@ -0,0 +1,18 @@ + + + + + + + + + + + diff --git a/Ink Canvas/Windows/SettingsViews/SettingsViews/UpdateCenterPanel.xaml.cs b/Ink Canvas/Windows/SettingsViews/SettingsViews/UpdateCenterPanel.xaml.cs new file mode 100644 index 00000000..a53c2c8d --- /dev/null +++ b/Ink Canvas/Windows/SettingsViews/SettingsViews/UpdateCenterPanel.xaml.cs @@ -0,0 +1,44 @@ +using iNKORE.UI.WPF.Helpers; +using System; +using System.Windows; +using System.Windows.Controls; + +namespace Ink_Canvas.Windows.SettingsViews +{ + public partial class UpdateCenterPanel : UserControl + { + public UpdateCenterPanel() + { + InitializeComponent(); + } + + public event EventHandler IsTopBarNeedShadowEffect; + public event EventHandler IsTopBarNeedNoShadowEffect; + + private void ScrollViewerEx_ScrollChanged(object sender, ScrollChangedEventArgs e) + { + var scrollViewer = (ScrollViewer)sender; + if (scrollViewer.VerticalOffset >= 10) + { + IsTopBarNeedShadowEffect?.Invoke(this, new RoutedEventArgs()); + } + else + { + IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs()); + } + } + + public void ApplyTheme() + { + try + { + ThemeHelper.ApplyThemeToControl(this); + } + catch (Exception ex) + { + System.Diagnostics.Debug.WriteLine($"UpdateCenterPanel 应用主题时出错: {ex.Message}"); + } + } + } +} + diff --git a/Ink Canvas/Windows/SettingsViews/SettingsWindow.xaml b/Ink Canvas/Windows/SettingsViews/SettingsWindow.xaml index ce0016f4..60f8cb07 100644 --- a/Ink Canvas/Windows/SettingsViews/SettingsWindow.xaml +++ b/Ink Canvas/Windows/SettingsViews/SettingsWindow.xaml @@ -196,6 +196,13 @@ + + + + + + + @@ -742,6 +749,11 @@ + + + + + diff --git a/Ink Canvas/Windows/SettingsViews/SettingsWindow.xaml.cs b/Ink Canvas/Windows/SettingsViews/SettingsWindow.xaml.cs index aa2cd8c0..035126be 100644 --- a/Ink Canvas/Windows/SettingsViews/SettingsWindow.xaml.cs +++ b/Ink Canvas/Windows/SettingsViews/SettingsWindow.xaml.cs @@ -153,6 +153,14 @@ namespace Ink_Canvas.Windows Type = SidebarItemType.Separator }); SidebarItems.Add(new SidebarItem() + { + Type = SidebarItemType.Item, + Title = "更新中心", + Name = "UpdateCenterItem", + IconSource = FindResource("UpdateCenterIcon") as DrawingImage, + Selected = false, + }); + SidebarItems.Add(new SidebarItem() { Type = SidebarItemType.Item, Title = "关于 InkCanvasForClass", @@ -161,6 +169,7 @@ namespace Ink_Canvas.Windows Selected = false, }); SettingsPanes = new Grid[] { + UpdateCenterPane, AboutPane, CanvasAndInkPane, GesturesPane, @@ -177,6 +186,7 @@ namespace Ink_Canvas.Windows }; SettingsPaneScrollViewers = new ScrollViewer[] { + UpdateCenterPanel.UpdateCenterScrollViewerEx, SettingsAboutPanel.AboutScrollViewerEx, CanvasAndInkPanel.ScrollViewerEx, GesturesPanel.ScrollViewerEx, @@ -193,6 +203,7 @@ namespace Ink_Canvas.Windows }; SettingsPaneTitles = new string[] { + "更新中心", "关于", "画板和墨迹", "手势操作", @@ -209,6 +220,7 @@ namespace Ink_Canvas.Windows }; SettingsPaneNames = new string[] { + "UpdateCenterItem", "AboutItem", "CanvasAndInkItem", "GesturesItem", @@ -259,6 +271,8 @@ namespace Ink_Canvas.Windows AdvancedPanel.IsTopBarNeedNoShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0; SnapshotPanel.IsTopBarNeedShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0.25; SnapshotPanel.IsTopBarNeedNoShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0; + UpdateCenterPanel.IsTopBarNeedShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0.25; + UpdateCenterPanel.IsTopBarNeedNoShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0; _selectedSidebarItemName = "StartupItem"; @@ -307,7 +321,7 @@ namespace Ink_Canvas.Windows // 使用反射调用所有面板的 ApplyTheme 方法(如果存在) var panels = new UserControl[] { - StartupPanel, CanvasAndInkPanel, GesturesPanel, InkRecognitionPanel, + UpdateCenterPanel, StartupPanel, CanvasAndInkPanel, GesturesPanel, InkRecognitionPanel, ThemePanel, ShortcutsPanel, CrashActionPanel, PowerPointPanel, AutomationPanel, LuckyRandomPanel, AdvancedPanel, SnapshotPanel, SettingsAboutPanel, AppearancePanel, SearchPanelControl @@ -754,6 +768,7 @@ namespace Ink_Canvas.Windows LuckyRandomPanel, AdvancedPanel, SnapshotPanel, + UpdateCenterPanel, SettingsAboutPanel, AppearancePanel }; @@ -947,6 +962,7 @@ namespace Ink_Canvas.Windows { "LuckyRandomItem", LuckyRandomPanel }, { "AdvancedItem", AdvancedPanel }, { "SnapshotItem", SnapshotPanel }, + { "UpdateCenterItem", UpdateCenterPanel }, { "AppearanceItem", AppearancePanel } }; @@ -964,6 +980,7 @@ namespace Ink_Canvas.Windows if (LuckyRandomPane != null) LuckyRandomPane.Visibility = _selectedSidebarItemName == "LuckyRandomItem" ? Visibility.Visible : Visibility.Collapsed; if (AdvancedPane != null) AdvancedPane.Visibility = _selectedSidebarItemName == "AdvancedItem" ? Visibility.Visible : Visibility.Collapsed; if (SnapshotPane != null) SnapshotPane.Visibility = _selectedSidebarItemName == "SnapshotItem" ? Visibility.Visible : Visibility.Collapsed; + if (UpdateCenterPane != null) UpdateCenterPane.Visibility = _selectedSidebarItemName == "UpdateCenterItem" ? Visibility.Visible : Visibility.Collapsed; // 为新显示的面板应用主题(延迟执行,确保面板已完全显示) if (panelMappings.ContainsKey(_selectedSidebarItemName))