Merge branch 'beta' into net6

This commit is contained in:
PrefacedCorg
2026-04-05 21:42:11 +08:00
9 changed files with 249 additions and 186 deletions
+12
View File
@@ -285,6 +285,7 @@ namespace Ink_Canvas.Helpers
// 功能快捷键 // 功能快捷键
RegisterHotkey("DrawLine", Key.L, ModifierKeys.Alt, () => _mainWindow.BtnDrawLine_Click(null, null)); RegisterHotkey("DrawLine", Key.L, ModifierKeys.Alt, () => _mainWindow.BtnDrawLine_Click(null, null));
RegisterHotkey("Screenshot", Key.C, ModifierKeys.Alt, () => _mainWindow.SaveScreenShotToDesktop()); RegisterHotkey("Screenshot", Key.C, ModifierKeys.Alt, () => _mainWindow.SaveScreenShotToDesktop());
RegisterHotkey("QuickDraw", Key.K, ModifierKeys.Alt, () => _mainWindow.OpenQuickDrawFromHotkey());
RegisterHotkey("Hide", Key.V, ModifierKeys.Alt, () => _mainWindow.SymbolIconEmoji_MouseUp(null, null)); RegisterHotkey("Hide", Key.V, ModifierKeys.Alt, () => _mainWindow.SymbolIconEmoji_MouseUp(null, null));
// 退出快捷键 // 退出快捷键
@@ -1033,6 +1034,7 @@ namespace Ink_Canvas.Helpers
new HotkeyConfigItem { Name = "Pen5", Key = Key.D5, Modifiers = ModifierKeys.Alt }, new HotkeyConfigItem { Name = "Pen5", Key = Key.D5, Modifiers = ModifierKeys.Alt },
new HotkeyConfigItem { Name = "DrawLine", Key = Key.L, Modifiers = ModifierKeys.Alt }, new HotkeyConfigItem { Name = "DrawLine", Key = Key.L, Modifiers = ModifierKeys.Alt },
new HotkeyConfigItem { Name = "Screenshot", Key = Key.C, Modifiers = ModifierKeys.Alt }, new HotkeyConfigItem { Name = "Screenshot", Key = Key.C, Modifiers = ModifierKeys.Alt },
new HotkeyConfigItem { Name = "QuickDraw", Key = Key.K, Modifiers = ModifierKeys.Alt },
new HotkeyConfigItem { Name = "Hide", Key = Key.V, Modifiers = ModifierKeys.Alt }, new HotkeyConfigItem { Name = "Hide", Key = Key.V, Modifiers = ModifierKeys.Alt },
new HotkeyConfigItem { Name = "Exit", Key = Key.Escape, Modifiers = ModifierKeys.None } new HotkeyConfigItem { Name = "Exit", Key = Key.Escape, Modifiers = ModifierKeys.None }
}); });
@@ -1111,6 +1113,14 @@ namespace Ink_Canvas.Helpers
} }
} }
// 旧版 HotkeyConfig.json 无「快抽」项时补注册默认组合,避免升级后无快捷键
if (successCount > 0 && !IsHotkeyRegistered("QuickDraw"))
{
var quickDrawAction = GetActionByName("QuickDraw");
if (quickDrawAction != null && RegisterHotkey("QuickDraw", Key.K, ModifierKeys.Alt, quickDrawAction))
successCount++;
}
if (successCount > 0) if (successCount > 0)
{ {
_hotkeysShouldBeRegistered = true; _hotkeysShouldBeRegistered = true;
@@ -1221,6 +1231,8 @@ namespace Ink_Canvas.Helpers
return () => _mainWindow.BtnDrawLine_Click(null, null); return () => _mainWindow.BtnDrawLine_Click(null, null);
case "Screenshot": case "Screenshot":
return () => _mainWindow.SaveScreenShotToDesktop(); return () => _mainWindow.SaveScreenShotToDesktop();
case "QuickDraw":
return () => _mainWindow.OpenQuickDrawFromHotkey();
case "Hide": case "Hide":
return () => _mainWindow.SymbolIconEmoji_MouseUp(null, null); return () => _mainWindow.SymbolIconEmoji_MouseUp(null, null);
case "Exit": case "Exit":
+16
View File
@@ -4711,6 +4711,22 @@ namespace Ink_Canvas
} }
} }
internal void OpenQuickDrawFromHotkey()
{
try
{
if (Settings?.RandSettings?.EnableQuickDraw != true)
return;
var quickDrawWindow = new QuickDrawWindow();
quickDrawWindow.ShowDialog();
}
catch (Exception ex)
{
LogHelper.WriteLogToFile($"打开快抽窗口失败: {ex.Message}", LogHelper.LogType.Error);
}
}
/// <summary> /// <summary>
/// 显示快抽悬浮按钮 /// 显示快抽悬浮按钮
/// </summary> /// </summary>
+1 -1
View File
@@ -1258,7 +1258,7 @@
<value>Exit slide show</value> <value>Exit slide show</value>
</data> </data>
<data name="QuickPanel_Show" xml:space="preserve"> <data name="QuickPanel_Show" xml:space="preserve">
<value>Show</value> <value>Annotation bar</value>
</data> </data>
<data name="QuickPanel_Exit" xml:space="preserve"> <data name="QuickPanel_Exit" xml:space="preserve">
<value>Exit</value> <value>Exit</value>
+1 -1
View File
@@ -1301,7 +1301,7 @@
<value>退出放映</value> <value>退出放映</value>
</data> </data>
<data name="QuickPanel_Show" xml:space="preserve"> <data name="QuickPanel_Show" xml:space="preserve">
<value>显示</value> <value>批注栏</value>
</data> </data>
<data name="QuickPanel_Exit" xml:space="preserve"> <data name="QuickPanel_Exit" xml:space="preserve">
<value>退出</value> <value>退出</value>
@@ -177,6 +177,11 @@
Description="保存屏幕截图到桌面" Description="保存屏幕截图到桌面"
DefaultKey="C" DefaultKey="C"
DefaultModifiers="Alt"/> DefaultModifiers="Alt"/>
<local:HotkeyItem x:Name="QuickDrawHotkey"
Title="快抽"
Description="打开快抽窗口(与悬浮快抽按钮相同)"
DefaultKey="K"
DefaultModifiers="Alt"/>
<local:HotkeyItem x:Name="HideHotkey" <local:HotkeyItem x:Name="HideHotkey"
Title="隐藏" Title="隐藏"
Description="隐藏应用程序" Description="隐藏应用程序"
@@ -135,6 +135,9 @@ namespace Ink_Canvas.Windows
_hotkeyItems["Screenshot"] = ScreenshotHotkey; _hotkeyItems["Screenshot"] = ScreenshotHotkey;
ScreenshotHotkey.HotkeyName = "Screenshot"; ScreenshotHotkey.HotkeyName = "Screenshot";
_hotkeyItems["QuickDraw"] = QuickDrawHotkey;
QuickDrawHotkey.HotkeyName = "QuickDraw";
_hotkeyItems["Hide"] = HideHotkey; _hotkeyItems["Hide"] = HideHotkey;
HideHotkey.HotkeyName = "Hide"; HideHotkey.HotkeyName = "Hide";
@@ -243,6 +246,9 @@ namespace Ink_Canvas.Windows
case "Screenshot": case "Screenshot":
hotkeyItem.SetCurrentHotkey(Key.C, ModifierKeys.Alt); hotkeyItem.SetCurrentHotkey(Key.C, ModifierKeys.Alt);
break; break;
case "QuickDraw":
hotkeyItem.SetCurrentHotkey(Key.K, ModifierKeys.Alt);
break;
case "Hide": case "Hide":
hotkeyItem.SetCurrentHotkey(Key.V, ModifierKeys.Alt); hotkeyItem.SetCurrentHotkey(Key.V, ModifierKeys.Alt);
break; break;
@@ -472,6 +478,8 @@ namespace Ink_Canvas.Windows
return () => _mainWindow.BtnDrawLine_Click(null, null); return () => _mainWindow.BtnDrawLine_Click(null, null);
case "Screenshot": case "Screenshot":
return () => _mainWindow.SaveScreenShotToDesktop(); return () => _mainWindow.SaveScreenShotToDesktop();
case "QuickDraw":
return () => _mainWindow.OpenQuickDrawFromHotkey();
case "Hide": case "Hide":
return () => _mainWindow.SymbolIconEmoji_MouseUp(null, null); return () => _mainWindow.SymbolIconEmoji_MouseUp(null, null);
case "Exit": case "Exit":
+204 -87
View File
@@ -3,99 +3,216 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Ink_Canvas"
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern" xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf" xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
ui:ThemeManager.RequestedTheme="Light" Topmost="True" Background="Transparent" mc:Ignorable="d"
mc:Ignorable="d" WindowStyle="None" AllowsTransparency="True"
WindowStartupLocation="CenterScreen"
Title="Ink Canvas Annotation 使用指南" Title="Ink Canvas Annotation 使用指南"
Height="600" Width="500"> Height="600"
<Border Background="{DynamicResource OperatingGuideWindowBackground}" CornerRadius="10" BorderThickness="1" BorderBrush="{DynamicResource OperatingGuideWindowBorderBrush}" Margin="10,10,10,50"> Width="520"
<Grid> MinHeight="400"
<Border MouseMove="WindowDragMove" Visibility="Visible" Width="64" Height="15" CornerRadius="8" Background="Gray" Margin="0,0,0,5" HorizontalAlignment="Center" VerticalAlignment="Bottom" /> MinWidth="400"
<ScrollViewer Margin="0,0,0,30" VerticalScrollBarVisibility="Auto" WindowStartupLocation="CenterScreen"
PanningMode="VerticalOnly" ui:ThemeManager.RequestedTheme="Light" Topmost="True"
ManipulationBoundaryFeedback="SCManipulationBoundaryFeedback"> ResizeMode="CanResize"
<ikw:SimpleStackPanel> FontFamily="Microsoft YaHei UI"
<ikw:SimpleStackPanel Margin="20,20,20,0" Orientation="Horizontal" HorizontalAlignment="Left"> ui:ThemeManager.IsThemeAware="True"
<Image Margin="5, 0" Source="{DynamicResource OperatingGuideWindowKeyboardIcon}" ui:TitleBar.ExtendViewIntoTitleBar="True"
RenderOptions.BitmapScalingMode="HighQuality" Height="40" Width="40"/> ui:WindowHelper.SystemBackdropType="Mica"
<TextBlock FontSize="22" Text="软件快捷键" TextWrapping="Wrap" VerticalAlignment="Center" Foreground="{DynamicResource OperatingGuideWindowTextForeground}"/> ui:WindowHelper.UseModernWindowStyle="True"
ui:TitleBar.Height="48">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- 自定义标题栏(与 OOBE / 隐私说明等 Fluent 窗口一致) -->
<Border x:Name="Border_TitleBarRoot"
Height="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}, Path=(ui:TitleBar.Height)}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}, Path=Title}"
VerticalAlignment="Center"
Margin="12,0,0,0"
FontSize="12"
FontWeight="SemiBold" />
<Rectangle Grid.Column="2"
Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}, Path=(ui:TitleBar.SystemOverlayRightInset)}" />
<ikw:SimpleStackPanel x:Name="StackPanel_RightButtons"
Grid.Column="1"
Orientation="Horizontal"
Spacing="5" />
</Grid>
</Border>
<Grid Grid.Row="1" Background="{DynamicResource SettingsPageBackground}">
<ScrollViewer Padding="0"
VerticalScrollBarVisibility="Auto"
PanningMode="VerticalOnly"
ManipulationBoundaryFeedback="SCManipulationBoundaryFeedback">
<ikw:SimpleStackPanel Margin="24,20,24,28" Spacing="4">
<ikw:SimpleStackPanel Margin="0,0,0,12"
Orientation="Horizontal"
HorizontalAlignment="Left"
Spacing="12">
<Image Height="32"
Width="32"
Source="{DynamicResource OperatingGuideWindowKeyboardIcon}"
RenderOptions.BitmapScalingMode="HighQuality" />
<TextBlock FontSize="20"
FontWeight="SemiBold"
Text="软件快捷键"
TextWrapping="Wrap"
VerticalAlignment="Center"
Foreground="{DynamicResource SettingsPageForeground}" />
</ikw:SimpleStackPanel> </ikw:SimpleStackPanel>
<Viewbox Height="320" HorizontalAlignment="Left"> <ikw:SimpleStackPanel Margin="0,0,0,8"
<ikw:SimpleStackPanel> MinHeight="28"
<ikw:SimpleStackPanel Margin="20, 0" Height="20" Orientation="Horizontal" HorizontalAlignment="Left"> Orientation="Horizontal"
<Image Source="{DynamicResource OperatingGuideWindowControlIcon1}" HorizontalAlignment="Left"
RenderOptions.BitmapScalingMode="HighQuality" Height="20" Width="20"/> Spacing="8">
<TextBlock FontSize="10" Text=" + Z —— 撤销" TextWrapping="Wrap" VerticalAlignment="Center" Foreground="{DynamicResource OperatingGuideWindowTextForeground}"/> <Image Source="{DynamicResource OperatingGuideWindowControlIcon1}"
</ikw:SimpleStackPanel> RenderOptions.BitmapScalingMode="HighQuality"
<ikw:SimpleStackPanel Margin="20, 0" Height="20" Orientation="Horizontal" HorizontalAlignment="Left"> Height="20"
<Image Source="{DynamicResource OperatingGuideWindowControlIcon2}" Width="20"
RenderOptions.BitmapScalingMode="HighQuality" Height="20" Width="20"/> VerticalAlignment="Center" />
<TextBlock FontSize="10" Text=" + Y —— 重做" TextWrapping="Wrap" VerticalAlignment="Center" Foreground="{DynamicResource OperatingGuideWindowTextForeground}"/> <TextBlock FontSize="14"
</ikw:SimpleStackPanel> Text=" + Z —— 撤销"
<ikw:SimpleStackPanel Margin="20, 0" Height="20" Orientation="Horizontal" HorizontalAlignment="Left"> TextWrapping="Wrap"
<Image Source="{DynamicResource OperatingGuideWindowControlIcon3}" VerticalAlignment="Center"
RenderOptions.BitmapScalingMode="HighQuality" Height="20" Width="20"/> Foreground="{DynamicResource SettingsPageForeground}" />
<TextBlock FontSize="10" Text=" + E —— 清屏" TextWrapping="Wrap" VerticalAlignment="Center" Foreground="{DynamicResource OperatingGuideWindowTextForeground}"/> </ikw:SimpleStackPanel>
</ikw:SimpleStackPanel> <ikw:SimpleStackPanel Margin="0,0,0,8"
<ikw:SimpleStackPanel Margin="20, 0" Height="20" Orientation="Horizontal" HorizontalAlignment="Left"> MinHeight="28"
<TextBlock FontSize="10" Text=" Alt + V —— 显示/隐藏笑脸右侧工具栏(Visibility" TextWrapping="Wrap" VerticalAlignment="Center" Foreground="{DynamicResource OperatingGuideWindowTextForeground}"/> Orientation="Horizontal"
</ikw:SimpleStackPanel> HorizontalAlignment="Left"
<ikw:SimpleStackPanel Margin="20, 0" Height="20" Orientation="Horizontal" HorizontalAlignment="Left"> Spacing="8">
<TextBlock FontSize="10" Text=" Alt + C —— 截屏(Capture" TextWrapping="Wrap" VerticalAlignment="Center" Foreground="{DynamicResource OperatingGuideWindowTextForeground}"/> <Image Source="{DynamicResource OperatingGuideWindowControlIcon2}"
</ikw:SimpleStackPanel> RenderOptions.BitmapScalingMode="HighQuality"
<ikw:SimpleStackPanel Margin="20, 0" Height="20" Orientation="Horizontal" HorizontalAlignment="Left"> Height="20"
<TextBlock FontSize="10" Text=" Alt + S —— 切换至选择模式(Select" TextWrapping="Wrap" VerticalAlignment="Center" Foreground="{DynamicResource OperatingGuideWindowTextForeground}"/> Width="20"
</ikw:SimpleStackPanel> VerticalAlignment="Center" />
<ikw:SimpleStackPanel Margin="20, 0" Height="20" Orientation="Horizontal" HorizontalAlignment="Left"> <TextBlock FontSize="14"
<TextBlock FontSize="10" Text=" Alt + D —— 切换至批注模式 / 墨迹颜色选择器(Draw" TextWrapping="Wrap" VerticalAlignment="Center" Foreground="{DynamicResource OperatingGuideWindowTextForeground}"/> Text=" + Y —— 重做"
</ikw:SimpleStackPanel> TextWrapping="Wrap"
<ikw:SimpleStackPanel Margin="20, 0" Height="20" Orientation="Horizontal" HorizontalAlignment="Left"> VerticalAlignment="Center"
<TextBlock FontSize="10" Text=" Alt + Q —— 退出批注模式(Quit" TextWrapping="Wrap" VerticalAlignment="Center" Foreground="{DynamicResource OperatingGuideWindowTextForeground}"/> Foreground="{DynamicResource SettingsPageForeground}" />
</ikw:SimpleStackPanel> </ikw:SimpleStackPanel>
<ikw:SimpleStackPanel Margin="20, 0" Height="20" Orientation="Horizontal" HorizontalAlignment="Left"> <ikw:SimpleStackPanel Margin="0,0,0,8"
<TextBlock FontSize="10" Text=" Alt + B —— 切换/退出画板模式(Board" TextWrapping="Wrap" VerticalAlignment="Center" Foreground="{DynamicResource OperatingGuideWindowTextForeground}"/> MinHeight="28"
</ikw:SimpleStackPanel> Orientation="Horizontal"
<ikw:SimpleStackPanel Margin="20, 0" Height="20" Orientation="Horizontal" HorizontalAlignment="Left"> HorizontalAlignment="Left"
<TextBlock FontSize="10" Text=" Alt + E —— 切换至面积擦/墨迹擦功能(Eraser" TextWrapping="Wrap" VerticalAlignment="Center" Foreground="{DynamicResource OperatingGuideWindowTextForeground}"/> Spacing="8">
</ikw:SimpleStackPanel> <Image Source="{DynamicResource OperatingGuideWindowControlIcon3}"
<ikw:SimpleStackPanel Margin="20, 0" Height="20" Orientation="Horizontal" HorizontalAlignment="Left"> RenderOptions.BitmapScalingMode="HighQuality"
<TextBlock FontSize="10" Text=" Alt + L —— 切换至单次直线绘制功能(Line" TextWrapping="Wrap" VerticalAlignment="Center" Foreground="{DynamicResource OperatingGuideWindowTextForeground}"/> Height="20"
</ikw:SimpleStackPanel> Width="20"
<ikw:SimpleStackPanel Margin="20, 0" Height="20" Orientation="Horizontal" HorizontalAlignment="Left"> VerticalAlignment="Center" />
<TextBlock FontSize="10" Text="Shift + Esc —— 退出 PPT 放映" TextWrapping="Wrap" VerticalAlignment="Center" Foreground="{DynamicResource OperatingGuideWindowTextForeground}"/> <TextBlock FontSize="14"
</ikw:SimpleStackPanel> Text=" + E —— 清屏"
</ikw:SimpleStackPanel> TextWrapping="Wrap"
</Viewbox> VerticalAlignment="Center"
Foreground="{DynamicResource SettingsPageForeground}" />
</ikw:SimpleStackPanel>
<ikw:SimpleStackPanel Margin="0,0,0,8"
MinHeight="28"
Orientation="Horizontal"
HorizontalAlignment="Left">
<TextBlock FontSize="14"
Text=" Alt + V —— 显示/隐藏笑脸右侧工具栏(Visibility"
TextWrapping="Wrap"
VerticalAlignment="Center"
Foreground="{DynamicResource SettingsPageForeground}" />
</ikw:SimpleStackPanel>
<ikw:SimpleStackPanel Margin="0,0,0,8"
MinHeight="28"
Orientation="Horizontal"
HorizontalAlignment="Left">
<TextBlock FontSize="14"
Text=" Alt + C —— 截屏(Capture"
TextWrapping="Wrap"
VerticalAlignment="Center"
Foreground="{DynamicResource SettingsPageForeground}" />
</ikw:SimpleStackPanel>
<ikw:SimpleStackPanel Margin="0,0,0,8"
MinHeight="28"
Orientation="Horizontal"
HorizontalAlignment="Left">
<TextBlock FontSize="14"
Text=" Alt + S —— 切换至选择模式(Select"
TextWrapping="Wrap"
VerticalAlignment="Center"
Foreground="{DynamicResource SettingsPageForeground}" />
</ikw:SimpleStackPanel>
<ikw:SimpleStackPanel Margin="0,0,0,8"
MinHeight="28"
Orientation="Horizontal"
HorizontalAlignment="Left">
<TextBlock FontSize="14"
Text=" Alt + D —— 切换至批注模式 / 墨迹颜色选择器(Draw)"
TextWrapping="Wrap"
VerticalAlignment="Center"
Foreground="{DynamicResource SettingsPageForeground}" />
</ikw:SimpleStackPanel>
<ikw:SimpleStackPanel Margin="0,0,0,8"
MinHeight="28"
Orientation="Horizontal"
HorizontalAlignment="Left">
<TextBlock FontSize="14"
Text=" Alt + Q —— 退出批注模式(Quit"
TextWrapping="Wrap"
VerticalAlignment="Center"
Foreground="{DynamicResource SettingsPageForeground}" />
</ikw:SimpleStackPanel>
<ikw:SimpleStackPanel Margin="0,0,0,8"
MinHeight="28"
Orientation="Horizontal"
HorizontalAlignment="Left">
<TextBlock FontSize="14"
Text=" Alt + B —— 切换/退出画板模式(Board)"
TextWrapping="Wrap"
VerticalAlignment="Center"
Foreground="{DynamicResource SettingsPageForeground}" />
</ikw:SimpleStackPanel>
<ikw:SimpleStackPanel Margin="0,0,0,8"
MinHeight="28"
Orientation="Horizontal"
HorizontalAlignment="Left">
<TextBlock FontSize="14"
Text=" Alt + E —— 切换至面积擦/墨迹擦功能(Eraser)"
TextWrapping="Wrap"
VerticalAlignment="Center"
Foreground="{DynamicResource SettingsPageForeground}" />
</ikw:SimpleStackPanel>
<ikw:SimpleStackPanel Margin="0,0,0,8"
MinHeight="28"
Orientation="Horizontal"
HorizontalAlignment="Left">
<TextBlock FontSize="14"
Text=" Alt + L —— 切换至单次直线绘制功能(Line)"
TextWrapping="Wrap"
VerticalAlignment="Center"
Foreground="{DynamicResource SettingsPageForeground}" />
</ikw:SimpleStackPanel>
<ikw:SimpleStackPanel MinHeight="28"
Orientation="Horizontal"
HorizontalAlignment="Left">
<TextBlock FontSize="14"
Text="Shift + Esc —— 退出 PPT 放映"
TextWrapping="Wrap"
VerticalAlignment="Center"
Foreground="{DynamicResource SettingsPageForeground}" />
</ikw:SimpleStackPanel>
</ikw:SimpleStackPanel> </ikw:SimpleStackPanel>
</ScrollViewer> </ScrollViewer>
<Viewbox Visibility="{Binding ElementName=BigViewController, Path=Visibility}" Margin="20,20,20,20" HorizontalAlignment="Right">
<ikw:SimpleStackPanel Height="180" Orientation="Horizontal">
<Border x:Name="BtnFullscreen" MouseUp="BtnFullscreen_MouseUp" HorizontalAlignment="Right" VerticalAlignment="Bottom"
Margin="5"
Background="{DynamicResource OperatingGuideWindowFullscreenButtonBackground}" Height="20" Width="20" CornerRadius="100">
<Border.Effect>
<DropShadowEffect Direction="0" ShadowDepth="0" Opacity="0.1" BlurRadius="3"/>
</Border.Effect>
<Viewbox Margin="5.5">
<ui:FontIcon Name="FontIconFullscreen" Icon="{x:Static ui:SegoeFluentIcons.FullScreen}" Foreground="{DynamicResource OperatingGuideWindowFullscreenButtonForeground}"/>
</Viewbox>
</Border>
<Border x:Name="BtnClose" MouseUp="BtnClose_MouseUp" HorizontalAlignment="Right" VerticalAlignment="Bottom"
Margin="5"
Background="{DynamicResource OperatingGuideWindowCloseButtonBackground}" Height="20" Width="20" CornerRadius="100">
<Border.Effect>
<DropShadowEffect Direction="0" ShadowDepth="0" Opacity="0.1" BlurRadius="3"/>
</Border.Effect>
<Viewbox Margin="5.5">
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Clear}" Foreground="{DynamicResource OperatingGuideWindowCloseButtonForeground}"/>
</Viewbox>
</Border>
</ikw:SimpleStackPanel>
</Viewbox>
</Grid> </Grid>
</Border> </Grid>
</Window> </Window>
@@ -1,6 +1,5 @@
using Ink_Canvas.Helpers; using Ink_Canvas.Helpers;
using iNKORE.UI.WPF.Modern; using iNKORE.UI.WPF.Modern;
using iNKORE.UI.WPF.Modern.Common.IconKeys;
using System; using System;
using System.Windows; using System.Windows;
using System.Windows.Input; using System.Windows.Input;
@@ -15,33 +14,10 @@ namespace Ink_Canvas
public OperatingGuideWindow() public OperatingGuideWindow()
{ {
InitializeComponent(); InitializeComponent();
RefreshTheme();
AnimationsHelper.ShowWithSlideFromBottomAndFade(this, 0.25); AnimationsHelper.ShowWithSlideFromBottomAndFade(this, 0.25);
} }
private void BtnClose_MouseUp(object sender, MouseButtonEventArgs e)
{
Close();
}
private void WindowDragMove(object sender, MouseEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed) DragMove();
}
private void BtnFullscreen_MouseUp(object sender, MouseButtonEventArgs e)
{
if (WindowState == WindowState.Normal)
{
WindowState = WindowState.Maximized;
FontIconFullscreen.Icon = SegoeFluentIcons.BackToWindow;
}
else
{
WindowState = WindowState.Normal;
FontIconFullscreen.Icon = SegoeFluentIcons.FullScreen;
}
}
private void SCManipulationBoundaryFeedback(object sender, ManipulationBoundaryFeedbackEventArgs e) private void SCManipulationBoundaryFeedback(object sender, ManipulationBoundaryFeedbackEventArgs e)
{ {
e.Handled = true; e.Handled = true;
@@ -6,33 +6,17 @@ using System.Windows;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Interop; using System.Windows.Interop;
using System.Windows.Input; using System.Windows.Input;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
using System.Linq; using System.Linq;
using MessageBox = System.Windows.MessageBox; using MessageBox = System.Windows.MessageBox;
using Screen = System.Windows.Forms.Screen; using Screen = System.Windows.Forms.Screen;
using System.Composition;
namespace Ink_Canvas.Windows.SettingsViews2 namespace Ink_Canvas.Windows.SettingsViews2
{ {
// 插件设置页面契约接口,所有插件必须实现此接口即可自动接入
public interface IPluginSettingsPage
{
string PageTag { get; } // 页面唯一标识,不可与内置页面重复
string PageTitle { get; } // 导航菜单显示的标题
string PageIconCode { get; } // Segoe MDL2 Assets 图标字符,例:"\xE713"(设置图标)
Type PageType { get; } // 插件设置页面的类型(继承自Page)
bool IsFooterItem { get; } // 是否放在导航底部菜单
}
public partial class SettingsWindow2 : Window public partial class SettingsWindow2 : Window
{ {
private readonly Dictionary<string, Type> _pageTypes; private readonly Dictionary<string, Type> _pageTypes;
private readonly Dictionary<string, object> _pages = new Dictionary<string, object>(); private readonly Dictionary<string, object> _pages = new Dictionary<string, object>();
[System.ComponentModel.Composition.ImportMany(typeof(IPluginSettingsPage))]
private IEnumerable<IPluginSettingsPage> _pluginPages; // 自动导入所有插件页面
// 保存窗口原始位置和大小 // 保存窗口原始位置和大小
private double _originalLeft; private double _originalLeft;
private double _originalTop; private double _originalTop;
@@ -64,11 +48,6 @@ namespace Ink_Canvas.Windows.SettingsViews2
{ "Settings", typeof(SettingsPage) } { "Settings", typeof(SettingsPage) }
}; };
// 加载插件页面
LoadPluginSettingsPages();
// 初始化导航菜单(内置+插件)
InitializeNavigationMenu();
// 默认选中首页 // 默认选中首页
if (NavigationViewControl.MenuItems.Count > 0) if (NavigationViewControl.MenuItems.Count > 0)
{ {
@@ -178,56 +157,6 @@ namespace Ink_Canvas.Windows.SettingsViews2
private static extern int ShowCursor(bool bShow); private static extern int ShowCursor(bool bShow);
#endregion #endregion
#region
private void LoadPluginSettingsPages()
{
try
{
// 扫描程序目录下Plugins文件夹中的插件dll
var pluginCatalog = new DirectoryCatalog("./Plugins", "*.dll");
var container = new CompositionContainer(pluginCatalog);
container.ComposeParts(this);
// 将插件页面注册到页面映射字典
foreach (var pluginPage in _pluginPages)
{
if (!_pageTypes.ContainsKey(pluginPage.PageTag))
{
_pageTypes.Add(pluginPage.PageTag, pluginPage.PageType);
}
}
}
catch (Exception ex)
{
// 插件加载失败不影响主程序运行,仅输出调试日志
System.Diagnostics.Debug.WriteLine($"插件加载失败: {ex.Message}");
}
}
private void InitializeNavigationMenu()
{
// 自动将插件页面添加到导航菜单
foreach (var pluginPage in _pluginPages)
{
var navItem = new NavigationViewItem
{
Tag = pluginPage.PageTag,
Content = pluginPage.PageTitle,
Icon = new FontIcon { Glyph = pluginPage.PageIconCode }
};
if (pluginPage.IsFooterItem)
{
NavigationViewControl.FooterMenuItems.Add(navItem);
}
else
{
NavigationViewControl.MenuItems.Add(navItem);
}
}
}
#endregion
#region DPI/ #region DPI/
/// <summary> /// <summary>
@@ -502,7 +431,7 @@ namespace Ink_Canvas.Windows.SettingsViews2
sender.ItemsSource = suggestions; sender.ItemsSource = suggestions;
} }
// 统一获取所有导航项(主菜单+子菜单+底部菜单+插件页面 // 统一获取所有导航项(主菜单+子菜单+底部菜单)
private List<NavigationViewItem> GetAllNavigationItems() private List<NavigationViewItem> GetAllNavigationItems()
{ {
var items = new List<NavigationViewItem>(); var items = new List<NavigationViewItem>();