From e0f35450e1ad9f5a1b6a20ab646c951dc53b162d Mon Sep 17 00:00:00 2001 From: PrefacedCorg <1876568293@qq.com> Date: Sun, 29 Mar 2026 17:39:52 +0800 Subject: [PATCH] add:NewNewSettings --- .../SettingsViews2/Pages/Appearance.xaml | 49 +++++++++++++++++ .../SettingsViews2/Pages/Appearance.xaml.cs | 52 +++++++++++++++++++ .../Windows/SettingsViews2/Pages/Basic.xaml | 27 ++++++++++ .../SettingsViews2/Pages/Basic.xaml.cs | 39 ++++++++++++++ .../Windows/SettingsViews2/Pages/Design.xaml | 38 ++++++++++++++ .../SettingsViews2/Pages/Design.xaml.cs | 43 +++++++++++++++ .../Pages/{Page1.xaml => Startup.xaml} | 11 ++-- .../Pages/{Page1.xaml.cs => Startup.xaml.cs} | 10 ++-- .../SettingsViews2/SettingsWindow2.xaml | 33 ++++++++---- .../SettingsViews2/SettingsWindow2.xaml.cs | 19 ++++--- 10 files changed, 293 insertions(+), 28 deletions(-) create mode 100644 Ink Canvas/Windows/SettingsViews2/Pages/Appearance.xaml create mode 100644 Ink Canvas/Windows/SettingsViews2/Pages/Appearance.xaml.cs create mode 100644 Ink Canvas/Windows/SettingsViews2/Pages/Basic.xaml create mode 100644 Ink Canvas/Windows/SettingsViews2/Pages/Basic.xaml.cs create mode 100644 Ink Canvas/Windows/SettingsViews2/Pages/Design.xaml create mode 100644 Ink Canvas/Windows/SettingsViews2/Pages/Design.xaml.cs rename Ink Canvas/Windows/SettingsViews2/Pages/{Page1.xaml => Startup.xaml} (55%) rename Ink Canvas/Windows/SettingsViews2/Pages/{Page1.xaml.cs => Startup.xaml.cs} (81%) diff --git a/Ink Canvas/Windows/SettingsViews2/Pages/Appearance.xaml b/Ink Canvas/Windows/SettingsViews2/Pages/Appearance.xaml new file mode 100644 index 00000000..a2dc7a2e --- /dev/null +++ b/Ink Canvas/Windows/SettingsViews2/Pages/Appearance.xaml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ink Canvas/Windows/SettingsViews2/Pages/Appearance.xaml.cs b/Ink Canvas/Windows/SettingsViews2/Pages/Appearance.xaml.cs new file mode 100644 index 00000000..f1c3c118 --- /dev/null +++ b/Ink Canvas/Windows/SettingsViews2/Pages/Appearance.xaml.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Ink_Canvas.Windows.SettingsViews2.Pages +{ + public partial class Appearance : Page + { + public Appearance() + { + InitializeComponent(); + } + + private void SettingsCard_Click(object sender, RoutedEventArgs e) + { + SettingsWindow2 settingsWindow = Window.GetWindow(this) as SettingsWindow2; + if (settingsWindow != null) + { + settingsWindow.NavigateToPage("Theme"); + } + } + + private void SettingsCard_Click_1(object sender, RoutedEventArgs e) + { + SettingsWindow2 settingsWindow = Window.GetWindow(this) as SettingsWindow2; + if (settingsWindow != null) + { + settingsWindow.NavigateToPage("Colors"); + } + } + + private void SettingsCard_Click_2(object sender, RoutedEventArgs e) + { + SettingsWindow2 settingsWindow = Window.GetWindow(this) as SettingsWindow2; + if (settingsWindow != null) + { + settingsWindow.NavigateToPage("Fonts"); + } + } + } +} diff --git a/Ink Canvas/Windows/SettingsViews2/Pages/Basic.xaml b/Ink Canvas/Windows/SettingsViews2/Pages/Basic.xaml new file mode 100644 index 00000000..1b5867e7 --- /dev/null +++ b/Ink Canvas/Windows/SettingsViews2/Pages/Basic.xaml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + diff --git a/Ink Canvas/Windows/SettingsViews2/Pages/Basic.xaml.cs b/Ink Canvas/Windows/SettingsViews2/Pages/Basic.xaml.cs new file mode 100644 index 00000000..1f99ab65 --- /dev/null +++ b/Ink Canvas/Windows/SettingsViews2/Pages/Basic.xaml.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Ink_Canvas.Windows.SettingsViews2.Pages +{ + /// + /// Basic.xaml 的交互逻辑 + /// + public partial class Basic : Page + { + public Basic() + { + InitializeComponent(); + } + + private void SettingsCard_Click(object sender, RoutedEventArgs e) + { + // 找到SettingsWindow2窗口 + SettingsWindow2 settingsWindow = Window.GetWindow(this) as SettingsWindow2; + if (settingsWindow != null) + { + // 调用NavigateToPage方法导航到启动页面 + settingsWindow.NavigateToPage("Startup"); + } + } + } +} diff --git a/Ink Canvas/Windows/SettingsViews2/Pages/Design.xaml b/Ink Canvas/Windows/SettingsViews2/Pages/Design.xaml new file mode 100644 index 00000000..8080ef41 --- /dev/null +++ b/Ink Canvas/Windows/SettingsViews2/Pages/Design.xaml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/Ink Canvas/Windows/SettingsViews2/Pages/Design.xaml.cs b/Ink Canvas/Windows/SettingsViews2/Pages/Design.xaml.cs new file mode 100644 index 00000000..99ca4813 --- /dev/null +++ b/Ink Canvas/Windows/SettingsViews2/Pages/Design.xaml.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Ink_Canvas.Windows.SettingsViews2.Pages +{ + public partial class Design : Page + { + public Design() + { + InitializeComponent(); + } + + private void SettingsCard_Click(object sender, RoutedEventArgs e) + { + SettingsWindow2 settingsWindow = Window.GetWindow(this) as SettingsWindow2; + if (settingsWindow != null) + { + settingsWindow.NavigateToPage("Iconography"); + } + } + + private void SettingsCard_Click_1(object sender, RoutedEventArgs e) + { + SettingsWindow2 settingsWindow = Window.GetWindow(this) as SettingsWindow2; + if (settingsWindow != null) + { + settingsWindow.NavigateToPage("Typography"); + } + } + } +} diff --git a/Ink Canvas/Windows/SettingsViews2/Pages/Page1.xaml b/Ink Canvas/Windows/SettingsViews2/Pages/Startup.xaml similarity index 55% rename from Ink Canvas/Windows/SettingsViews2/Pages/Page1.xaml rename to Ink Canvas/Windows/SettingsViews2/Pages/Startup.xaml index a0da6416..8292aea2 100644 --- a/Ink Canvas/Windows/SettingsViews2/Pages/Page1.xaml +++ b/Ink Canvas/Windows/SettingsViews2/Pages/Startup.xaml @@ -1,4 +1,4 @@ - + Title="启动"> - + + + + - + \ No newline at end of file diff --git a/Ink Canvas/Windows/SettingsViews2/Pages/Page1.xaml.cs b/Ink Canvas/Windows/SettingsViews2/Pages/Startup.xaml.cs similarity index 81% rename from Ink Canvas/Windows/SettingsViews2/Pages/Page1.xaml.cs rename to Ink Canvas/Windows/SettingsViews2/Pages/Startup.xaml.cs index 58e98e87..0df42597 100644 --- a/Ink Canvas/Windows/SettingsViews2/Pages/Page1.xaml.cs +++ b/Ink Canvas/Windows/SettingsViews2/Pages/Startup.xaml.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -16,13 +16,13 @@ using System.Windows.Shapes; namespace Ink_Canvas.Windows.SettingsViews2.Pages { /// - /// Page1.xaml 的交互逻辑 + /// Startup.xaml 的交互逻辑 /// - public partial class Page1 : Page + public partial class Startup : Page { - public Page1() + public Startup() { InitializeComponent(); } } -} +} \ No newline at end of file diff --git a/Ink Canvas/Windows/SettingsViews2/SettingsWindow2.xaml b/Ink Canvas/Windows/SettingsViews2/SettingsWindow2.xaml index 3d96e338..b8d88f5d 100644 --- a/Ink Canvas/Windows/SettingsViews2/SettingsWindow2.xaml +++ b/Ink Canvas/Windows/SettingsViews2/SettingsWindow2.xaml @@ -56,7 +56,7 @@ MinWidth="200" VerticalAlignment="Center" x:FieldModifier="public" - PlaceholderText="搜索设置" + PlaceholderText="查找设置" QuerySubmitted="OnControlsSearchBoxQuerySubmitted" TextChanged="OnControlsSearchBoxTextChanged" > @@ -67,12 +67,25 @@ + x:Name="BasicItem" + Content="基本" + Tag="Basic" + SelectsOnInvoked="True" + ToolTipService.ToolTip="基本设置"> - + + + + + + + + + Tag="Design" + SelectsOnInvoked="True"> - + + Tag="Appearance" + SelectsOnInvoked="True"> - + { - { "Page1", typeof(Page1) }, + { "Basic", typeof(Basic) }, { "Page2", typeof(Page2) }, + { "Design", typeof(Design) }, + { "Appearance", typeof(Appearance) }, { "Iconography", typeof(Iconography) }, { "Typography", typeof(Typography) }, { "Theme", typeof(Theme) }, { "Colors", typeof(Colors) }, { "Fonts", typeof(Fonts) }, + { "Startup", typeof(Startup) }, { "About", typeof(About) }, { "Settings", typeof(SettingsPage) } }; @@ -46,21 +49,17 @@ namespace Ink_Canvas.Windows.SettingsViews2 } else if (args.SelectedItem is iNKORE.UI.WPF.Modern.Controls.NavigationViewItem item) { - // 检查是否是子导航项(没有子菜单) - if (item.MenuItems.Count == 0) + // 检查是否有Tag,如果有则导航 + string tag = item.Tag as string; + if (!string.IsNullOrEmpty(tag)) { - // 如果是子导航项,直接导航 - string tag = item.Tag as string; - if (!string.IsNullOrEmpty(tag)) - { - NavigateToPage(tag); - } + NavigateToPage(tag); } // 父级导航项(有子菜单)会自动展开,不需要额外处理 } } - private void NavigateToPage(string pageTag) + public void NavigateToPage(string pageTag) { if (_pageTypes.TryGetValue(pageTag, out Type pageType)) {