From 1bf57ea2f52a98523c776ab4807d3208e6dc75d0 Mon Sep 17 00:00:00 2001
From: PrefacedCorg <1876568293@qq.com>
Date: Sun, 29 Mar 2026 12:38:46 +0800
Subject: [PATCH 01/36] 1
---
Ink Canvas/MainWindow.xaml | 3 +
Ink Canvas/MainWindow.xaml.cs | 12 ++
.../Windows/SettingsViews2/Pages/Page1.xaml | 14 ++
.../SettingsViews2/Pages/Page1.xaml.cs | 28 ++++
.../Windows/SettingsViews2/Pages/Page2.xaml | 14 ++
.../SettingsViews2/Pages/Page2.xaml.cs | 28 ++++
.../SettingsViews2/SettingsWindow2.xaml | 130 ++++++++++++++++++
.../SettingsViews2/SettingsWindow2.xaml.cs | 127 +++++++++++++++++
8 files changed, 356 insertions(+)
create mode 100644 Ink Canvas/Windows/SettingsViews2/Pages/Page1.xaml
create mode 100644 Ink Canvas/Windows/SettingsViews2/Pages/Page1.xaml.cs
create mode 100644 Ink Canvas/Windows/SettingsViews2/Pages/Page2.xaml
create mode 100644 Ink Canvas/Windows/SettingsViews2/Pages/Page2.xaml.cs
create mode 100644 Ink Canvas/Windows/SettingsViews2/SettingsWindow2.xaml
create mode 100644 Ink Canvas/Windows/SettingsViews2/SettingsWindow2.xaml.cs
diff --git a/Ink Canvas/MainWindow.xaml b/Ink Canvas/MainWindow.xaml
index 9af46a13..ac5756e4 100644
--- a/Ink Canvas/MainWindow.xaml
+++ b/Ink Canvas/MainWindow.xaml
@@ -662,6 +662,9 @@
+
diff --git a/Ink Canvas/MainWindow.xaml.cs b/Ink Canvas/MainWindow.xaml.cs
index c441956c..dcea47b6 100644
--- a/Ink Canvas/MainWindow.xaml.cs
+++ b/Ink Canvas/MainWindow.xaml.cs
@@ -2907,6 +2907,18 @@ private async void BtnOpenNewSettings_Click(object sender, RoutedEventArgs e)
}
}
+
+ private async void BtnOpenNewNewSettings_Click(object sender, RoutedEventArgs e)
+ {
+ if (isOpeningOrHidingSettingsPane) return;
+ HideSubPanels();
+ {
+ var settingsWindow = new Windows.SettingsViews2.SettingsWindow2();
+ settingsWindow.Owner = this;
+ settingsWindow.ShowDialog();
+ }
+ }
+
#endregion 新设置窗口
// 在MainWindow类中添加:
diff --git a/Ink Canvas/Windows/SettingsViews2/Pages/Page1.xaml b/Ink Canvas/Windows/SettingsViews2/Pages/Page1.xaml
new file mode 100644
index 00000000..a0da6416
--- /dev/null
+++ b/Ink Canvas/Windows/SettingsViews2/Pages/Page1.xaml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
diff --git a/Ink Canvas/Windows/SettingsViews2/Pages/Page1.xaml.cs b/Ink Canvas/Windows/SettingsViews2/Pages/Page1.xaml.cs
new file mode 100644
index 00000000..58e98e87
--- /dev/null
+++ b/Ink Canvas/Windows/SettingsViews2/Pages/Page1.xaml.cs
@@ -0,0 +1,28 @@
+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
+{
+ ///
+ /// Page1.xaml 的交互逻辑
+ ///
+ public partial class Page1 : Page
+ {
+ public Page1()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Ink Canvas/Windows/SettingsViews2/Pages/Page2.xaml b/Ink Canvas/Windows/SettingsViews2/Pages/Page2.xaml
new file mode 100644
index 00000000..cab33024
--- /dev/null
+++ b/Ink Canvas/Windows/SettingsViews2/Pages/Page2.xaml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
diff --git a/Ink Canvas/Windows/SettingsViews2/Pages/Page2.xaml.cs b/Ink Canvas/Windows/SettingsViews2/Pages/Page2.xaml.cs
new file mode 100644
index 00000000..0e389f1e
--- /dev/null
+++ b/Ink Canvas/Windows/SettingsViews2/Pages/Page2.xaml.cs
@@ -0,0 +1,28 @@
+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
+{
+ ///
+ /// Page2.xaml 的交互逻辑
+ ///
+ public partial class Page2 : Page
+ {
+ public Page2()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Ink Canvas/Windows/SettingsViews2/SettingsWindow2.xaml b/Ink Canvas/Windows/SettingsViews2/SettingsWindow2.xaml
new file mode 100644
index 00000000..fc92a5ac
--- /dev/null
+++ b/Ink Canvas/Windows/SettingsViews2/SettingsWindow2.xaml
@@ -0,0 +1,130 @@
+
+
+
+
+
+
+ 4,2,4,2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Ink Canvas/Windows/SettingsViews2/SettingsWindow2.xaml.cs b/Ink Canvas/Windows/SettingsViews2/SettingsWindow2.xaml.cs
new file mode 100644
index 00000000..0ab3d8d1
--- /dev/null
+++ b/Ink Canvas/Windows/SettingsViews2/SettingsWindow2.xaml.cs
@@ -0,0 +1,127 @@
+using Ink_Canvas.Windows.SettingsViews2.Pages;
+using iNKORE.UI.WPF.Modern.Controls;
+using System;
+using System.Collections.Generic;
+using System.Windows;
+using System.Windows.Navigation;
+
+namespace Ink_Canvas.Windows.SettingsViews2
+{
+ public partial class SettingsWindow2 : Window
+ {
+ private Dictionary _pageTypes;
+ private Dictionary _pages = new Dictionary();
+
+ public SettingsWindow2()
+ {
+ InitializeComponent();
+
+ // 初始化页面类型映射
+ _pageTypes = new Dictionary
+ {
+ { "Page1", typeof(Page1) },
+ { "Page2", typeof(Page2) }
+ };
+
+ // 默认选中第一个项目
+ if (NavigationViewControl.MenuItems.Count > 0)
+ {
+ NavigationViewControl.SelectedItem = NavigationViewControl.MenuItems[0];
+ }
+ }
+
+ private void OnNavigationViewSelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args)
+ {
+ if (args.IsSettingsSelected)
+ {
+ // 暂时导航到 Page1 作为设置页示例
+ NavigateToPage("Page1");
+ }
+ else if (args.SelectedItem is iNKORE.UI.WPF.Modern.Controls.NavigationViewItem item)
+ {
+ var tag = item.Tag as string;
+ if (!string.IsNullOrEmpty(tag))
+ {
+ NavigateToPage(tag);
+ }
+ }
+ }
+
+ private void NavigateToPage(string pageTag)
+ {
+ if (_pageTypes.TryGetValue(pageTag, out Type pageType))
+ {
+ try
+ {
+ if (!_pages.TryGetValue(pageTag, out object page))
+ {
+ page = Activator.CreateInstance(pageType);
+ _pages[pageTag] = page;
+ }
+
+ if (page != null)
+ {
+ rootFrame.Navigate(page);
+ // 更新标题
+ if (NavigationViewControl.SelectedItem is iNKORE.UI.WPF.Modern.Controls.NavigationViewItem selectedItem)
+ {
+ NavigationViewControl.Header = selectedItem.Content;
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ iNKORE.UI.WPF.Modern.Controls.MessageBox.Show($"导航到页面时出错: {ex.Message}", "错误");
+ }
+ }
+ }
+
+ private void OnControlsSearchBoxQuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
+ {
+ var query = args.QueryText.ToLower();
+ var allItems = new List