add:新设置
This commit is contained in:
@@ -73,8 +73,8 @@
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#9a9996" FontSize="12" Margin="0,0,0,3" Text="用户版权信息" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="2024 孙笑川一中 高2026级114班" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="12" Margin="0,0,0,3" Text="设备ID" HorizontalAlignment="Left"/>
|
||||
<TextBlock Name="AboutUserCopyright" Foreground="#2e3436" FontSize="14.5" Text="2024 孙笑川一中 高2026级114班" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
@@ -84,8 +84,8 @@
|
||||
<Grid Height="54">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="软件版本" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,18,0">
|
||||
<TextBlock Foreground="#878787" FontSize="14.5" Text="InkCanvasForClass v2024.8.30" VerticalAlignment="Center" />
|
||||
<Image Margin="12,0,0,0" Width="18" Height="18" VerticalAlignment="Center">
|
||||
<TextBlock Name="AboutSoftwareVersion" Foreground="#878787" FontSize="14.5" Text="InkCanvasForClass v1.7.18.4" VerticalAlignment="Center" />
|
||||
<Image x:Name="UpdateAvailableIcon" Margin="12,0,0,0" Width="18" Height="18" VerticalAlignment="Center" Visibility="Collapsed">
|
||||
<Image.Source>
|
||||
<DrawingImage>
|
||||
<DrawingImage.Drawing>
|
||||
@@ -119,7 +119,7 @@
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="版权信息" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
|
||||
<TextBlock Foreground="#878787" FontSize="14.5" Text="© Copyright 2024 Dubi906w 所有" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,18,0"/>
|
||||
<TextBlock Name="AboutCopyright" Foreground="#878787" FontSize="14.5" Text="© Copyright 2024-2026" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,18,0"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
@@ -128,7 +128,7 @@
|
||||
<Grid Height="54">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="ICC 官方网站" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,18,0">
|
||||
<TextBlock Foreground="#1d4ed8" TextDecorations="Underline" FontSize="14.5" Text="icc.bliemhax.com" VerticalAlignment="Center" HorizontalAlignment="Right"/>
|
||||
<TextBlock Name="AboutOfficialWebsiteLink" Foreground="#1d4ed8" TextDecorations="Underline" FontSize="14.5" Text="forum.smart-teach.cn/t/icc-ce" VerticalAlignment="Center" HorizontalAlignment="Right"/>
|
||||
<Image Margin="12,0,0,0" Width="16" Height="16" VerticalAlignment="Center">
|
||||
<Image.Source>
|
||||
<DrawingImage>
|
||||
@@ -146,7 +146,7 @@
|
||||
<Grid Height="54">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="Github 仓库" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,18,0">
|
||||
<TextBlock Foreground="#1d4ed8" TextDecorations="Underline" FontSize="14.5" Text="github.com/InkCanvas/InkCanvasForClass" VerticalAlignment="Center" HorizontalAlignment="Right"/>
|
||||
<TextBlock Name="AboutGithubLink" Foreground="#1d4ed8" TextDecorations="Underline" FontSize="14.5" Text="github.com/InkCanvasForClass/community" VerticalAlignment="Center" HorizontalAlignment="Right"/>
|
||||
<Image Margin="12,0,0,0" Width="16" Height="16" VerticalAlignment="Center">
|
||||
<Image.Source>
|
||||
<DrawingImage>
|
||||
@@ -164,7 +164,7 @@
|
||||
<Grid Height="54">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="贡献者名单" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,18,0">
|
||||
<TextBlock Foreground="#1d4ed8" TextDecorations="Underline" FontSize="14.5" Text="icc.bliemhax.com/contributors" VerticalAlignment="Center" HorizontalAlignment="Right"/>
|
||||
<TextBlock Name="AboutContributorsLink" Foreground="#1d4ed8" TextDecorations="Underline" FontSize="14.5" Text="github.com/InkCanvasForClass/community#贡献者" VerticalAlignment="Center" HorizontalAlignment="Right"/>
|
||||
<Image Margin="12,0,0,0" Width="16" Height="16" VerticalAlignment="Center">
|
||||
<Image.Source>
|
||||
<DrawingImage>
|
||||
@@ -181,7 +181,7 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<StackPanel Orientation="Vertical" Margin="0,16,0,0">
|
||||
<TextBlock Foreground="#2e3436" FontWeight="Bold" FontSize="12" Text="© Copyright 2024 Dubi906w(Doubx690i/kriastans) 所有" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,15,0"/>
|
||||
<TextBlock Name="AboutBottomCopyright" Foreground="#2e3436" FontWeight="Bold" FontSize="12" Text="© Copyright 2024-2026" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,15,0"/>
|
||||
<TextBlock Foreground="#878787" Width="356" FlowDirection="RightToLeft" TextWrapping="Wrap" FontSize="12" Text="ICC 的部分元素设计参考来源于:© iNKORE! 名下产品 Inkways,已经过授权使用,最终解释权归 Yoojun Zhou 所有" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,6,15,0"/>
|
||||
<TextBlock Foreground="#878787" FontWeight="Bold" Width="276" FlowDirection="RightToLeft" TextWrapping="Wrap" FontSize="12" Text="ICC 使用了 iNKORE! 开发的 UI 组件库:iNKORE.UI.WPF.Modern" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,6,15,0"/>
|
||||
</StackPanel>
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
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;
|
||||
@@ -17,16 +19,14 @@ using System.Windows.Media.Imaging;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
/// <summary>
|
||||
/// AboutPanel.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class AboutPanel : UserControl
|
||||
{
|
||||
public AboutPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// 关于页面图片横幅
|
||||
Loaded += AboutPanel_Loaded;
|
||||
|
||||
if (File.Exists(App.RootPath + "icc-about-illustrations.png"))
|
||||
{
|
||||
try
|
||||
@@ -42,8 +42,22 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
CopyrightBannerImage.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
// 关于页面构建时间
|
||||
var buildTime = FileBuildTimeHelper.GetBuildDateTime(Assembly.GetExecutingAssembly());
|
||||
try
|
||||
{
|
||||
var assembly = Assembly.GetExecutingAssembly();
|
||||
var version = assembly.GetName().Version;
|
||||
var assemblyTitle = assembly.GetCustomAttribute<AssemblyTitleAttribute>()?.Title ?? "InkCanvasForClass";
|
||||
AboutSoftwareVersion.Text = $"{assemblyTitle} v{version.Major}.{version.Minor}.{version.Build}.{version.Revision}";
|
||||
}
|
||||
catch
|
||||
{
|
||||
AboutSoftwareVersion.Text = "InkCanvasForClass v1.7.18.0";
|
||||
}
|
||||
|
||||
UpdateSystemInfo();
|
||||
|
||||
// 以下残留代码已移至 UpdateSystemInfo() 方法,应删除
|
||||
/*
|
||||
if (buildTime != null)
|
||||
{
|
||||
var bt = ((DateTimeOffset)buildTime).LocalDateTime;
|
||||
@@ -56,18 +70,115 @@ 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<AssemblyCopyrightAttribute>()?.Copyright ?? "? Copyright 2024-2026";
|
||||
AboutCopyright.Text = copyright;
|
||||
|
||||
if (AboutBottomCopyright != null)
|
||||
{
|
||||
var company = assembly.GetCustomAttribute<AssemblyCompanyAttribute>()?.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
|
||||
@@ -143,8 +254,8 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
fileStream.Position = 0x3C;
|
||||
fileStream.Read(buffer, 0, 4);
|
||||
fileStream.Position = BitConverter.ToUInt32(buffer, 0); // COFF header offset
|
||||
fileStream.Read(buffer, 0, 4); // "PE\0\0"
|
||||
fileStream.Position = BitConverter.ToUInt32(buffer, 0);
|
||||
fileStream.Read(buffer, 0, 4);
|
||||
fileStream.Read(buffer, 0, buffer.Length);
|
||||
}
|
||||
var pinnedBuffer = GCHandle.Alloc(buffer, GCHandleType.Pinned);
|
||||
@@ -259,19 +370,171 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
var border = thumb.Template.FindName("ScrollbarThumbEx", thumb);
|
||||
((Border)border).Background = new SolidColorBrush(Color.FromRgb(138, 138, 138));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
UpdateLinkColors();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"AboutPanel 应用主题时出错: {ex.Message}");
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="ComboBoxStyles.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<!-- 开关样式模板 -->
|
||||
<Style x:Key="ToggleSwitchStyle" TargetType="Border">
|
||||
<Setter Property="Width" Value="48"/>
|
||||
<Setter Property="Height" Value="25"/>
|
||||
@@ -27,7 +26,6 @@
|
||||
</UserControl.Resources>
|
||||
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="ScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
|
||||
<StackPanel Margin="60,12,60,24">
|
||||
<!-- 特殊屏幕和触摸设置 -->
|
||||
<Border BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="可在手指触摸画板时显示圆形橡皮或手掌触摸画板时显示的橡皮比手掌大很多时调整"
|
||||
@@ -38,7 +36,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="启用特殊屏幕模式以优化触摸体验" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchIsSpecialScreen" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="IsSpecialScreen" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -63,7 +61,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="橡皮擦大小与触摸大小倍数绑定" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEraserBindTouchMultiplier" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EraserBindTouchMultiplier" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -98,8 +96,8 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="四边红外模式" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="启用四边红外触摸屏模式" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchIsQuadIR" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchIsQuadIR" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="IsQuadIR" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -109,7 +107,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 日志和系统设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<Grid Height="54">
|
||||
@@ -117,8 +114,8 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="记录日志" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="启用日志记录功能" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchIsLogEnabled" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchIsLogEnabled" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="IsLogEnabled" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -135,8 +132,8 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="日志以日期保存" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="日志文件超过 512 KB 时会自动删除。开启日期保存后,日志将保存在Logs文件夹中,当文件夹大小超过5MB时自动清空" HorizontalAlignment="Left" MaxWidth="450"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchIsSaveLogByDate" Grid.Column="1" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" VerticalAlignment="Top" Margin="0,8,15,8">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchIsSaveLogByDate" Grid.Column="1" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" VerticalAlignment="Top" Margin="0,8,15,8" Tag="IsSaveLogByDate" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -149,8 +146,8 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="关闭软件时二次弹窗确认" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="关闭软件时显示确认对话框" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchIsSecondConfimeWhenShutdownApp" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchIsSecondConfimeWhenShutdownApp" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="IsSecondConfirmWhenShutdownApp" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -160,7 +157,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 实验性功能 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="实验性选项" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
@@ -185,8 +181,8 @@
|
||||
</Border>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启用FullScreenHelper" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchIsEnableFullScreenHelper" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchIsEnableFullScreenHelper" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="IsEnableFullScreenHelper" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -217,8 +213,8 @@
|
||||
</Border>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启用AvoidFullScreenHelper" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchIsEnableAvoidFullScreenHelper" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchIsEnableAvoidFullScreenHelper" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="IsEnableAvoidFullScreenHelper" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -249,8 +245,8 @@
|
||||
</Border>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启用EdgeGestureUtil" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchIsEnableEdgeGestureUtil" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchIsEnableEdgeGestureUtil" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="IsEnableEdgeGestureUtil" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -281,8 +277,8 @@
|
||||
</Border>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启用ForceFullScreen" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchIsEnableForceFullScreen" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchIsEnableForceFullScreen" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="IsEnableForceFullScreen" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -313,8 +309,8 @@
|
||||
</Border>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启用DPIChangeDetection" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchIsEnableDPIChangeDetection" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchIsEnableDPIChangeDetection" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="IsEnableDPIChangeDetection" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -345,8 +341,8 @@
|
||||
</Border>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启用ResolutionChangeDetection" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchIsEnableResolutionChangeDetection" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchIsEnableResolutionChangeDetection" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="IsEnableResolutionChangeDetection" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -358,7 +354,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 设置备份与还原 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="设置备份与还原" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
@@ -369,8 +364,8 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="自动更新前备份" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在自动更新前自动备份当前设置" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchIsAutoBackupBeforeUpdate" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchIsAutoBackupBeforeUpdate" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="IsAutoBackupBeforeUpdate" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -383,8 +378,8 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="定期自动备份" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="定期自动备份设置文件" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchIsAutoBackupEnabled" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchIsAutoBackupEnabled" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="IsAutoBackupEnabled" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -404,7 +399,7 @@
|
||||
<Border x:Name="AutoBackupInterval3DaysBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="AutoBackupInterval_3" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="3天"/>
|
||||
</Border>
|
||||
<Border x:Name="AutoBackupInterval7DaysBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="AutoBackupInterval_7" Margin="0,0,8,8">
|
||||
<Border x:Name="AutoBackupInterval7DaysBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="AutoBackupInterval_7" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="7天"/>
|
||||
</Border>
|
||||
<Border x:Name="AutoBackupInterval14DaysBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="AutoBackupInterval_14" Margin="0,0,8,8">
|
||||
@@ -417,27 +412,30 @@
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,8,0,0">
|
||||
<Button x:Name="BtnManualBackup" Content="手动备份" Padding="12,6" Margin="0,0,12,0" Background="#2563eb" Foreground="White"/>
|
||||
<Button x:Name="BtnRestoreBackup" Content="还原备份" Padding="12,6" Background="#2563eb" Foreground="White"/>
|
||||
<Button x:Name="BtnManualBackup" Content="手动备份" Padding="12,6" Margin="0,0,12,0"/>
|
||||
<Button x:Name="BtnRestoreBackup" Content="还原备份" Padding="12,6"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 文件关联管理 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="文件关联管理" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
<TextBlock Text="管理.icstk文件的关联设置,双击.icstk文件可直接在Ink Canvas中打开"
|
||||
TextWrapping="Wrap" Foreground="#9a9996" FontSize="11" Margin="0,0,0,12"/>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,8,0,0">
|
||||
<Button x:Name="BtnUnregisterFileAssociation" Content="取消文件关联" Padding="15,5" Margin="0,0,8,0" Background="#2563eb" Foreground="White"/>
|
||||
<Button x:Name="BtnCheckFileAssociation" Content="检查关联状态" Padding="15,5" Margin="0,0,8,0" Background="#2563eb" Foreground="White"/>
|
||||
<Button x:Name="BtnRegisterFileAssociation" Content="重新注册关联" Padding="15,5" Background="#2563eb" Foreground="White"/>
|
||||
<Button x:Name="BtnUnregisterFileAssociation" Content="取消文件关联" Padding="15,5" Margin="0,0,8,0"/>
|
||||
<Button x:Name="BtnCheckFileAssociation" Content="检查关联状态" Padding="15,5" Margin="0,0,8,0"/>
|
||||
<Button x:Name="BtnRegisterFileAssociation" Content="重新注册关联" Padding="15,5"/>
|
||||
</StackPanel>
|
||||
<TextBlock x:Name="FileAssociationStatusText"
|
||||
TextWrapping="Wrap"
|
||||
FontSize="12"
|
||||
Margin="0,8,0,0"
|
||||
Visibility="Collapsed"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 悬浮窗拦截 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="悬浮窗拦截" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
@@ -448,15 +446,14 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启用悬浮窗拦截" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后自动检测并拦截同类软件的悬浮窗" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchFloatingWindowInterceptorEnabled" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchFloatingWindowInterceptorEnabled" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="FloatingWindowInterceptorEnabled" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<!-- 拦截规则网格 -->
|
||||
<Grid x:Name="FloatingWindowInterceptorGrid" Margin="0,12,0,0" Visibility="Collapsed">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
@@ -470,156 +467,143 @@
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<!-- 希沃白板3 -->
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<Image Source="/Resources/Icons-png/EasiNote3.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="希沃白板3" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchSeewoWhiteboard3Floating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchSeewoWhiteboard3Floating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" Tag="SeewoWhiteboard3Floating" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<!-- 希沃白板5 -->
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<Image Source="/Resources/Icons-png/EasiNote.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="希沃白板5" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchSeewoWhiteboard5Floating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchSeewoWhiteboard5Floating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" Tag="SeewoWhiteboard5Floating" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<!-- 希沃白板5C -->
|
||||
<StackPanel Grid.Row="0" Grid.Column="2" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<Image Source="/Resources/Icons-png/EasiNote5C.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="希沃白板5C" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchSeewoWhiteboard5CFloating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchSeewoWhiteboard5CFloating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" Tag="SeewoWhiteboard5CFloating" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<!-- 希沃品课 -->
|
||||
<StackPanel Grid.Row="0" Grid.Column="3" Orientation="Vertical" Margin="0,0,0,12">
|
||||
<Image Source="/Resources/Icons-png/SeewoPinco.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="希沃品课" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchSeewoPincoSideBarFloating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchSeewoPincoSideBarFloating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" Tag="SeewoPincoSideBarFloating" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<!-- 希沃品课画笔 -->
|
||||
<StackPanel Grid.Row="1" Grid.Column="0" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<Image Source="/Resources/Icons-png/SeewoPinco.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="希沃品课画笔" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchSeewoPincoDrawingFloating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchSeewoPincoDrawingFloating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" Tag="SeewoPincoDrawingFloating" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<!-- 希沃PPT小工具 -->
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<Image Source="/Resources/Icons-png/PPTTools.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="希沃PPT小工具" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchSeewoPPTFloating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchSeewoPPTFloating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" Tag="SeewoPPTFloating" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<!-- AiClass -->
|
||||
<StackPanel Grid.Row="1" Grid.Column="2" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<Image Source="/Resources/Icons-png/AiClass.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="AiClass" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchAiClassFloating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchAiClassFloating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" Tag="AiClassFloating" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<!-- 鸿合屏幕书写 -->
|
||||
<StackPanel Grid.Row="1" Grid.Column="3" Orientation="Vertical" Margin="0,0,0,12">
|
||||
<Image Source="/Resources/Icons-png/HiteAnnotation.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="鸿合屏幕书写" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchHiteAnnotationFloating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchHiteAnnotationFloating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" Tag="HiteAnnotationFloating" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<!-- 畅言智慧课堂 -->
|
||||
<StackPanel Grid.Row="2" Grid.Column="0" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<Image Source="/Resources/Icons-png/畅言智慧课堂.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="畅言智慧课堂" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchChangYanFloating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchChangYanFloating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" Tag="ChangYanFloating" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<!-- 畅言PPT -->
|
||||
<StackPanel Grid.Row="2" Grid.Column="1" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<Image Source="/Resources/Icons-png/畅言智慧课堂.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="畅言PPT" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchChangYanPptFloating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchChangYanPptFloating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" Tag="ChangYanPptFloating" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<!-- 天喻教育云 -->
|
||||
<StackPanel Grid.Row="2" Grid.Column="2" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<Image Source="/Resources/Icons-png/天喻教育云.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="天喻教育云" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchIntelligentClassFloating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchIntelligentClassFloating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" Tag="IntelligentClassFloating" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<!-- 希沃桌面画笔 -->
|
||||
<StackPanel Grid.Row="2" Grid.Column="3" Orientation="Vertical" Margin="0,0,0,12">
|
||||
<Image Source="/Resources/Icons-png/SeewoPinco.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="希沃桌面画笔" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchSeewoDesktopAnnotationFloating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchSeewoDesktopAnnotationFloating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" Tag="SeewoDesktopAnnotationFloating" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<!-- 希沃桌面侧栏 -->
|
||||
<StackPanel Grid.Row="3" Grid.Column="0" Orientation="Vertical" Margin="0,0,8,0">
|
||||
<Image Source="/Resources/Icons-png/SeewoPinco.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="希沃桌面侧栏" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchSeewoDesktopSideBarFloating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchSeewoDesktopSideBarFloating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" Tag="SeewoDesktopSideBarFloating" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -632,11 +616,10 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- Dlass设置管理 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="Dlass设置管理" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
<Button x:Name="BtnDlassSettingsManage" Content="Dlass设置管理" Padding="15,5" HorizontalAlignment="Left" Background="#2563eb" Foreground="White"/>
|
||||
<Button x:Name="BtnDlassSettingsManage" Content="Dlass设置管理" Padding="15,5" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Ink_Canvas;
|
||||
using Ink_Canvas;
|
||||
using Ink_Canvas.Helpers;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -9,9 +10,6 @@ using Application = System.Windows.Application;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
/// <summary>
|
||||
/// AdvancedPanel.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class AdvancedPanel : UserControl
|
||||
{
|
||||
private bool _isLoaded = false;
|
||||
@@ -25,21 +23,15 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
private void AdvancedPanel_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LoadSettings();
|
||||
// 添加触摸支持
|
||||
EnableTouchSupport();
|
||||
// 应用主题
|
||||
ApplyTheme();
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为面板中的所有交互控件启用触摸支持
|
||||
/// </summary>
|
||||
private void EnableTouchSupport()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 延迟执行,确保所有控件都已加载
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
MainWindowSettingsHelper.EnableTouchSupportForControls(this);
|
||||
@@ -47,7 +39,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"AdvancedPanel 启用触摸支持时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"AdvancedPanel 启用触摸支持时出�? {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,9 +59,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载设置到UI
|
||||
/// </summary>
|
||||
public void LoadSettings()
|
||||
{
|
||||
if (MainWindow.Settings == null || MainWindow.Settings.Advanced == null) return;
|
||||
@@ -80,10 +69,8 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
var advanced = MainWindow.Settings.Advanced;
|
||||
|
||||
// 特殊屏幕模式
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchIsSpecialScreen"), advanced.IsSpecialScreen);
|
||||
|
||||
// 触摸倍数
|
||||
if (TouchMultiplierSlider != null)
|
||||
{
|
||||
TouchMultiplierSlider.Value = advanced.TouchMultiplier;
|
||||
@@ -93,10 +80,8 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
// 橡皮擦绑定触摸大小倍数
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEraserBindTouchMultiplier"), advanced.EraserBindTouchMultiplier);
|
||||
|
||||
// 笔尖模式 BoundsWidth
|
||||
if (NibModeBoundsWidthSlider != null)
|
||||
{
|
||||
NibModeBoundsWidthSlider.Value = advanced.NibModeBoundsWidth;
|
||||
@@ -106,7 +91,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
// 手指模式 BoundsWidth
|
||||
if (FingerModeBoundsWidthSlider != null)
|
||||
{
|
||||
FingerModeBoundsWidthSlider.Value = advanced.FingerModeBoundsWidth;
|
||||
@@ -116,19 +100,14 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
// 四边红外模式
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchIsQuadIR"), advanced.IsQuadIR);
|
||||
|
||||
// 记录日志
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchIsLogEnabled"), advanced.IsLogEnabled);
|
||||
|
||||
// 日志以日期保存
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchIsSaveLogByDate"), advanced.IsSaveLogByDate);
|
||||
|
||||
// 关闭软件时二次弹窗确认
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchIsSecondConfimeWhenShutdownApp"), advanced.IsSecondConfirmWhenShutdownApp);
|
||||
|
||||
// 实验性功能
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchIsEnableFullScreenHelper"), advanced.IsEnableFullScreenHelper);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchIsEnableAvoidFullScreenHelper"), advanced.IsEnableAvoidFullScreenHelper);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchIsEnableEdgeGestureUtil"), advanced.IsEnableEdgeGestureUtil);
|
||||
@@ -136,40 +115,52 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchIsEnableDPIChangeDetection"), advanced.IsEnableDPIChangeDetection);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchIsEnableResolutionChangeDetection"), advanced.IsEnableResolutionChangeDetection);
|
||||
|
||||
// 备份设置
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchIsAutoBackupBeforeUpdate"), advanced.IsAutoBackupBeforeUpdate);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchIsAutoBackupEnabled"), advanced.IsAutoBackupEnabled);
|
||||
SetOptionButtonState("AutoBackupInterval", advanced.AutoBackupIntervalDays);
|
||||
|
||||
// 悬浮窗拦截
|
||||
// 注意:IsEnableFloatingWindowInterception 可能不在 Advanced 类中,需要确认
|
||||
// 这里先假设它在 Advanced 类中,如果不在,需要调整
|
||||
if (MainWindow.Settings.Automation != null && MainWindow.Settings.Automation.FloatingWindowInterceptor != null)
|
||||
{
|
||||
var interceptor = MainWindow.Settings.Automation.FloatingWindowInterceptor;
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchFloatingWindowInterceptorEnabled"), interceptor.IsEnabled);
|
||||
|
||||
if (interceptor.InterceptRules != null)
|
||||
{
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchSeewoWhiteboard3Floating"), interceptor.InterceptRules.ContainsKey("SeewoWhiteboard3Floating") && interceptor.InterceptRules["SeewoWhiteboard3Floating"]);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchSeewoWhiteboard5Floating"), interceptor.InterceptRules.ContainsKey("SeewoWhiteboard5Floating") && interceptor.InterceptRules["SeewoWhiteboard5Floating"]);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchSeewoWhiteboard5CFloating"), interceptor.InterceptRules.ContainsKey("SeewoWhiteboard5CFloating") && interceptor.InterceptRules["SeewoWhiteboard5CFloating"]);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchSeewoPincoSideBarFloating"), interceptor.InterceptRules.ContainsKey("SeewoPincoSideBarFloating") && interceptor.InterceptRules["SeewoPincoSideBarFloating"]);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchSeewoPincoDrawingFloating"), interceptor.InterceptRules.ContainsKey("SeewoPincoDrawingFloating") && interceptor.InterceptRules["SeewoPincoDrawingFloating"]);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchSeewoPPTFloating"), interceptor.InterceptRules.ContainsKey("SeewoPPTFloating") && interceptor.InterceptRules["SeewoPPTFloating"]);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAiClassFloating"), interceptor.InterceptRules.ContainsKey("AiClassFloating") && interceptor.InterceptRules["AiClassFloating"]);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchHiteAnnotationFloating"), interceptor.InterceptRules.ContainsKey("HiteAnnotationFloating") && interceptor.InterceptRules["HiteAnnotationFloating"]);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchChangYanFloating"), interceptor.InterceptRules.ContainsKey("ChangYanFloating") && interceptor.InterceptRules["ChangYanFloating"]);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchChangYanPptFloating"), interceptor.InterceptRules.ContainsKey("ChangYanPptFloating") && interceptor.InterceptRules["ChangYanPptFloating"]);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchIntelligentClassFloating"), interceptor.InterceptRules.ContainsKey("IntelligentClassFloating") && interceptor.InterceptRules["IntelligentClassFloating"]);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchSeewoDesktopAnnotationFloating"), interceptor.InterceptRules.ContainsKey("SeewoDesktopAnnotationFloating") && interceptor.InterceptRules["SeewoDesktopAnnotationFloating"]);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchSeewoDesktopSideBarFloating"), interceptor.InterceptRules.ContainsKey("SeewoDesktopSideBarFloating") && interceptor.InterceptRules["SeewoDesktopSideBarFloating"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"加载高级设置时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"加载高级设置时出�? {ex.Message}");
|
||||
}
|
||||
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找ToggleSwitch控件
|
||||
/// </summary>
|
||||
private Border FindToggleSwitch(string name)
|
||||
{
|
||||
return this.FindDescendantByName(name) as Border;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置ToggleSwitch状态
|
||||
/// </summary>
|
||||
private void SetToggleSwitchState(Border toggleSwitch, bool isOn)
|
||||
{
|
||||
if (toggleSwitch == null) return;
|
||||
toggleSwitch.Background = isOn
|
||||
? new SolidColorBrush(Color.FromRgb(53, 132, 228))
|
||||
: ThemeHelper.GetButtonBackgroundBrush();
|
||||
? ThemeHelper.GetToggleSwitchOnBackgroundBrush()
|
||||
: ThemeHelper.GetToggleSwitchOffBackgroundBrush();
|
||||
var innerBorder = toggleSwitch.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
@@ -177,9 +168,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置选项按钮状态
|
||||
/// </summary>
|
||||
private void SetOptionButtonState(string group, int selectedValue)
|
||||
{
|
||||
var buttons = new Dictionary<string, Dictionary<int, string>>
|
||||
@@ -196,7 +184,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
var button = this.FindDescendantByName($"{group}{buttonName}Border") as Border;
|
||||
if (button != null)
|
||||
{
|
||||
// 清除同组其他按钮的选中状态
|
||||
var parent = button.Parent as Panel;
|
||||
if (parent != null)
|
||||
{
|
||||
@@ -207,30 +194,16 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
string childTag = childBorder.Tag?.ToString();
|
||||
if (!string.IsNullOrEmpty(childTag) && childTag.StartsWith(group + "_"))
|
||||
{
|
||||
childBorder.Background = new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = childBorder.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
ThemeHelper.SetOptionButtonSelectedState(childBorder, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 设置当前按钮为选中状态
|
||||
button.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var currentTextBlock = button.Child as TextBlock;
|
||||
if (currentTextBlock != null)
|
||||
{
|
||||
currentTextBlock.FontWeight = FontWeights.Bold;
|
||||
}
|
||||
ThemeHelper.SetOptionButtonSelectedState(button, true);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ToggleSwitch点击事件处理
|
||||
/// </summary>
|
||||
private void ToggleSwitch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
@@ -238,7 +211,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
bool isOn = border.Background.ToString() == "#FF3584E4";
|
||||
bool isOn = ThemeHelper.IsToggleSwitchOn(border.Background);
|
||||
bool newState = !isOn;
|
||||
SetToggleSwitchState(border, newState);
|
||||
|
||||
@@ -251,80 +224,119 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
switch (tag)
|
||||
{
|
||||
case "IsSpecialScreen":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchIsSpecialScreen", newState);
|
||||
break;
|
||||
|
||||
case "EraserBindTouchMultiplier":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEraserBindTouchMultiplier", newState);
|
||||
break;
|
||||
|
||||
case "IsQuadIR":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchIsQuadIR", newState);
|
||||
break;
|
||||
|
||||
case "IsLogEnabled":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchIsLogEnabled", newState);
|
||||
break;
|
||||
|
||||
case "IsSaveLogByDate":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchIsSaveLogByDate", newState);
|
||||
break;
|
||||
|
||||
case "IsSecondConfirmWhenShutdownApp":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchIsSecondConfimeWhenShutdownApp", newState);
|
||||
break;
|
||||
|
||||
case "IsEnableFullScreenHelper":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchIsEnableFullScreenHelper", newState);
|
||||
break;
|
||||
|
||||
case "IsEnableAvoidFullScreenHelper":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchIsEnableAvoidFullScreenHelper", newState);
|
||||
break;
|
||||
|
||||
case "IsEnableEdgeGestureUtil":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchIsEnableEdgeGestureUtil", newState);
|
||||
break;
|
||||
|
||||
case "IsEnableForceFullScreen":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchIsEnableForceFullScreen", newState);
|
||||
break;
|
||||
|
||||
case "IsEnableDPIChangeDetection":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchIsEnableDPIChangeDetection", newState);
|
||||
break;
|
||||
|
||||
case "IsEnableResolutionChangeDetection":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchIsEnableResolutionChangeDetection", newState);
|
||||
break;
|
||||
|
||||
case "IsAutoBackupBeforeUpdate":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchIsAutoBackupBeforeUpdate", newState);
|
||||
break;
|
||||
|
||||
case "IsAutoBackupEnabled":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchIsAutoBackupEnabled", newState);
|
||||
break;
|
||||
|
||||
case "FloatingWindowInterceptorEnabled":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchFloatingWindowInterceptorEnabled", newState);
|
||||
break;
|
||||
|
||||
case "SeewoWhiteboard3Floating":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchSeewoWhiteboard3Floating", newState);
|
||||
break;
|
||||
|
||||
case "SeewoWhiteboard5Floating":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchSeewoWhiteboard5Floating", newState);
|
||||
break;
|
||||
|
||||
case "SeewoWhiteboard5CFloating":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchSeewoWhiteboard5CFloating", newState);
|
||||
break;
|
||||
|
||||
case "SeewoPincoSideBarFloating":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchSeewoPincoSideBarFloating", newState);
|
||||
break;
|
||||
|
||||
case "SeewoPincoDrawingFloating":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchSeewoPincoDrawingFloating", newState);
|
||||
break;
|
||||
|
||||
case "SeewoPPTFloating":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchSeewoPPTFloating", newState);
|
||||
break;
|
||||
|
||||
case "AiClassFloating":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAiClassFloating", newState);
|
||||
break;
|
||||
|
||||
case "HiteAnnotationFloating":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchHiteAnnotationFloating", newState);
|
||||
break;
|
||||
|
||||
case "ChangYanFloating":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchChangYanFloating", newState);
|
||||
break;
|
||||
|
||||
case "ChangYanPptFloating":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchChangYanPptFloating", newState);
|
||||
break;
|
||||
|
||||
case "IntelligentClassFloating":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchIntelligentClassFloating", newState);
|
||||
break;
|
||||
|
||||
case "SeewoDesktopAnnotationFloating":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchSeewoDesktopAnnotationFloating", newState);
|
||||
break;
|
||||
|
||||
case "SeewoDesktopSideBarFloating":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchSeewoDesktopSideBarFloating", newState);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Slider值变化事件处理
|
||||
/// </summary>
|
||||
private void TouchMultiplierSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
@@ -332,7 +344,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
double value = TouchMultiplierSlider.Value;
|
||||
TouchMultiplierText.Text = value.ToString("F2");
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("TouchMultiplierSlider", value);
|
||||
}
|
||||
}
|
||||
@@ -344,7 +355,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
double value = NibModeBoundsWidthSlider.Value;
|
||||
NibModeBoundsWidthText.Text = ((int)value).ToString();
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("NibModeBoundsWidthSlider", value);
|
||||
}
|
||||
}
|
||||
@@ -356,14 +366,10 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
double value = FingerModeBoundsWidthSlider.Value;
|
||||
FingerModeBoundsWidthText.Text = ((int)value).ToString();
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("FingerModeBoundsWidthSlider", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选项按钮点击事件处理
|
||||
/// </summary>
|
||||
private void OptionButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
@@ -380,7 +386,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
string group = parts[0];
|
||||
string value = parts[1];
|
||||
|
||||
// 清除同组其他按钮的选中状态
|
||||
var parent = border.Parent as Panel;
|
||||
if (parent != null)
|
||||
{
|
||||
@@ -391,24 +396,13 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
string childTag = childBorder.Tag?.ToString();
|
||||
if (!string.IsNullOrEmpty(childTag) && childTag.StartsWith(group + "_"))
|
||||
{
|
||||
childBorder.Background = new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = childBorder.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
ThemeHelper.SetOptionButtonSelectedState(childBorder, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 设置当前按钮为选中状态
|
||||
border.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var currentTextBlock = border.Child as TextBlock;
|
||||
if (currentTextBlock != null)
|
||||
{
|
||||
currentTextBlock.FontWeight = FontWeights.Bold;
|
||||
}
|
||||
ThemeHelper.SetOptionButtonSelectedState(border, true);
|
||||
|
||||
if (MainWindow.Settings.Advanced == null) return;
|
||||
|
||||
@@ -418,14 +412,12 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
int days;
|
||||
if (int.TryParse(value, out days))
|
||||
{
|
||||
// 尝试调用 MainWindow 中的方法
|
||||
var mainWindow = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow != null)
|
||||
{
|
||||
var comboBox = mainWindow.FindName("ComboBoxAutoBackupInterval") as System.Windows.Controls.ComboBox;
|
||||
if (comboBox != null)
|
||||
{
|
||||
// 找到对应的选项并设置
|
||||
foreach (ComboBoxItem item in comboBox.Items)
|
||||
{
|
||||
if (item.Tag != null && int.TryParse(item.Tag.ToString(), out int tagValue) && tagValue == days)
|
||||
@@ -438,7 +430,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
MainWindow.Settings.Advanced.AutoBackupIntervalDays = days;
|
||||
@@ -450,57 +441,81 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按钮点击事件处理(备份还原、文件关联等)
|
||||
/// </summary>
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var button = sender as Button;
|
||||
if (button == null) return;
|
||||
|
||||
string name = button.Name;
|
||||
// 这些按钮的功能可能需要调用 MainWindow 中的方法
|
||||
// 暂时先留空,后续可以根据需要实现
|
||||
switch (name)
|
||||
{
|
||||
case "BtnManualBackup":
|
||||
// TODO: 调用 MainWindow 的备份方法
|
||||
break;
|
||||
|
||||
case "BtnRestoreBackup":
|
||||
// TODO: 调用 MainWindow 的还原方法
|
||||
break;
|
||||
|
||||
case "BtnUnregisterFileAssociation":
|
||||
// TODO: 调用 MainWindow 的取消文件关联方法
|
||||
break;
|
||||
|
||||
case "BtnCheckFileAssociation":
|
||||
// TODO: 调用 MainWindow 的检查文件关联方法
|
||||
CheckFileAssociationStatus();
|
||||
break;
|
||||
|
||||
case "BtnRegisterFileAssociation":
|
||||
// TODO: 调用 MainWindow 的注册文件关联方法
|
||||
break;
|
||||
|
||||
case "BtnDlassSettingsManage":
|
||||
// TODO: 调用 MainWindow 的 Dlass 设置管理方法
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckFileAssociationStatus()
|
||||
{
|
||||
try
|
||||
{
|
||||
bool isRegistered = FileAssociationManager.IsFileAssociationRegistered();
|
||||
|
||||
if (FileAssociationStatusText != null)
|
||||
{
|
||||
FileAssociationStatusText.Visibility = Visibility.Visible;
|
||||
|
||||
if (isRegistered)
|
||||
{
|
||||
FileAssociationStatusText.Text = "✓ .icstk文件关联已注册";
|
||||
FileAssociationStatusText.Foreground = new SolidColorBrush(Colors.LightGreen);
|
||||
}
|
||||
else
|
||||
{
|
||||
FileAssociationStatusText.Text = "✗ .icstk文件关联未注册";
|
||||
FileAssociationStatusText.Foreground = new SolidColorBrush(Colors.LightCoral);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (FileAssociationStatusText != null)
|
||||
{
|
||||
FileAssociationStatusText.Visibility = Visibility.Visible;
|
||||
FileAssociationStatusText.Text = $"✗ 检查文件关联状态时出错: {ex.Message}";
|
||||
FileAssociationStatusText.Foreground = new SolidColorBrush(Colors.LightCoral);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
if (MainWindow.Settings?.Advanced != null)
|
||||
{
|
||||
SetOptionButtonState("AutoBackupInterval", MainWindow.Settings.Advanced.AutoBackupIntervalDays);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"AdvancedPanel 应用主题时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"AdvancedPanel 应用主题时出�? {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="ComboBoxStyles.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<!-- 开关样式模板 -->
|
||||
<Style x:Key="ToggleSwitchStyle" TargetType="Border">
|
||||
<Setter Property="Width" Value="48"/>
|
||||
<Setter Property="Height" Value="25"/>
|
||||
@@ -27,7 +26,6 @@
|
||||
</UserControl.Resources>
|
||||
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="ScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
|
||||
<StackPanel Margin="60,12,60,24">
|
||||
<!-- 主题设置 -->
|
||||
<Border BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
@@ -50,7 +48,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 启动动画设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
@@ -58,8 +55,8 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启用启动动画" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="启动时显示动画效果" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableSplashScreen" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchEnableSplashScreen" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="EnableSplashScreen" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -99,7 +96,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 浮动工具栏设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<StackPanel Margin="18,8,18,8">
|
||||
@@ -193,8 +189,8 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="在调色盘窗口中显示 笔尖模式 按钮" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在调色盘窗口中显示笔尖模式切换按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableDisPlayNibModeToggle" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchEnableDisPlayNibModeToggle" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="EnableDisPlayNibModeToggle" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -212,7 +208,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 浮动栏按钮显示设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="浮动栏按钮显示" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
@@ -326,7 +321,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 任务栏托盘图标设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="任务栏托盘图标" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
@@ -335,8 +329,8 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启用托盘图标" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在任务栏系统托盘显示图标" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableTrayIcon" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchEnableTrayIcon" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnableTrayIcon" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -346,7 +340,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 白板设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
@@ -354,8 +347,8 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="白板 UI 80% 缩放" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="将白板界面缩放至80%" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableViewboxBlackBoardScaleTransform" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchEnableViewboxBlackBoardScaleTransform" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnableViewboxBlackBoardScaleTransform" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -368,8 +361,8 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="在白板中显示当前时间和日期" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在白板界面显示当前时间和日期" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableTimeDisplayInWhiteboardMode" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchEnableTimeDisplayInWhiteboardMode" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnableTimeDisplayInWhiteboardMode" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -382,8 +375,8 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="在白板中显示信仰の源1(好喝的/毒的鸡汤)" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在白板界面显示励志语句" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableChickenSoupInWhiteboardMode" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchEnableChickenSoupInWhiteboardMode" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnableChickenSoupInWhiteboardMode" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -414,7 +407,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 收纳模式设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
@@ -422,8 +414,8 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="在收纳模式下启用快速面板" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在收纳模式下显示快速操作面板" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableQuickPanel" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchEnableQuickPanel" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnableQuickPanel" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -451,8 +443,8 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="退出收纳模式时自动切换至批注模式" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后,退出收纳模式时将自动切换至批注模式,便于快速批注" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoEnterAnnotationModeWhenExitFoldMode" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchAutoEnterAnnotationModeWhenExitFoldMode" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="AutoEnterAnnotationModeWhenExitFoldMode" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -465,8 +457,8 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="退出PPT放映后自动收纳浮动栏" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后,退出PPT放映后会自动收纳浮动栏" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoFoldAfterPPTSlideShow" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchAutoFoldAfterPPTSlideShow" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="AutoFoldAfterPPTSlideShow" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -479,8 +471,8 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="退出白板时自动收纳" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后,退出白板模式时会自动收纳到侧边栏" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoFoldWhenExitWhiteboard" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchAutoFoldWhenExitWhiteboard" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="AutoFoldWhenExitWhiteboard" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
using System;
|
||||
using Ink_Canvas;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
/// <summary>
|
||||
/// AppearancePanel.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class AppearancePanel : UserControl
|
||||
{
|
||||
private bool _isLoaded = false;
|
||||
@@ -20,16 +19,10 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
private void AppearancePanel_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LoadSettings();
|
||||
// 添加触摸支持
|
||||
MainWindowSettingsHelper.EnableTouchSupportForControls(this);
|
||||
// 应用主题
|
||||
ApplyTheme();
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载设置
|
||||
/// </summary>
|
||||
public void LoadSettings()
|
||||
{
|
||||
if (MainWindow.Settings == null || MainWindow.Settings.Appearance == null) return;
|
||||
@@ -39,8 +32,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
try
|
||||
{
|
||||
var appearance = MainWindow.Settings.Appearance;
|
||||
|
||||
// 浮动工具栏缩放
|
||||
if (ViewboxFloatingBarScaleTransformValueSlider != null)
|
||||
{
|
||||
double val = appearance.ViewboxFloatingBarScaleTransformValue;
|
||||
@@ -51,8 +42,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
ViewboxFloatingBarScaleTransformValueText.Text = val.ToString("F2");
|
||||
}
|
||||
}
|
||||
|
||||
// 浮动工具栏透明度
|
||||
if (ViewboxFloatingBarOpacityValueSlider != null)
|
||||
{
|
||||
ViewboxFloatingBarOpacityValueSlider.Value = appearance.ViewboxFloatingBarOpacityValue;
|
||||
@@ -61,8 +50,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
ViewboxFloatingBarOpacityValueText.Text = appearance.ViewboxFloatingBarOpacityValue.ToString("F2");
|
||||
}
|
||||
}
|
||||
|
||||
// 浮栏在PPT下透明度
|
||||
if (ViewboxFloatingBarOpacityInPPTValueSlider != null)
|
||||
{
|
||||
ViewboxFloatingBarOpacityInPPTValueSlider.Value = appearance.ViewboxFloatingBarOpacityInPPTValue;
|
||||
@@ -74,7 +61,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"加载外观设置时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"�����������ʱ����: {ex.Message}");
|
||||
}
|
||||
|
||||
_isLoaded = true;
|
||||
@@ -95,10 +82,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
@@ -107,13 +90,9 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"AppearancePanel 应用主题时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"AppearancePanel Ӧ������ʱ����: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Slider值变化事件处理
|
||||
/// </summary>
|
||||
private void ViewboxFloatingBarScaleTransformValueSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
@@ -146,5 +125,83 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("ViewboxFloatingBarOpacityInPPTValueSlider", val);
|
||||
}
|
||||
}
|
||||
private Border FindToggleSwitch(string name)
|
||||
{
|
||||
return this.FindDescendantByName(name) as Border;
|
||||
}
|
||||
private void SetToggleSwitchState(Border toggleSwitch, bool isOn)
|
||||
{
|
||||
if (toggleSwitch == null) return;
|
||||
toggleSwitch.Background = isOn
|
||||
? ThemeHelper.GetToggleSwitchOnBackgroundBrush()
|
||||
: ThemeHelper.GetToggleSwitchOffBackgroundBrush();
|
||||
var innerBorder = toggleSwitch.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
innerBorder.HorizontalAlignment = isOn ? HorizontalAlignment.Right : HorizontalAlignment.Left;
|
||||
}
|
||||
}
|
||||
private void ToggleSwitch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
e.Handled = true;
|
||||
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
bool isOn = ThemeHelper.IsToggleSwitchOn(border.Background);
|
||||
bool newState = !isOn;
|
||||
SetToggleSwitchState(border, newState);
|
||||
|
||||
string tag = border.Tag?.ToString();
|
||||
if (string.IsNullOrEmpty(tag)) return;
|
||||
|
||||
switch (tag)
|
||||
{
|
||||
case "EnableSplashScreen":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggledWithThemeCheck("ToggleSwitchEnableSplashScreen", newState);
|
||||
if (SplashScreenStylePanel != null)
|
||||
{
|
||||
SplashScreenStylePanel.Visibility = newState ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
break;
|
||||
|
||||
case "EnableDisPlayNibModeToggle":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableDisPlayNibModeToggle", newState);
|
||||
break;
|
||||
|
||||
case "EnableTrayIcon":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggledWithThemeCheck("ToggleSwitchEnableTrayIcon", newState);
|
||||
break;
|
||||
|
||||
case "EnableViewboxBlackBoardScaleTransform":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableViewboxBlackBoardScaleTransform", newState);
|
||||
break;
|
||||
|
||||
case "EnableTimeDisplayInWhiteboardMode":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableTimeDisplayInWhiteboardMode", newState);
|
||||
break;
|
||||
|
||||
case "EnableChickenSoupInWhiteboardMode":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableChickenSoupInWhiteboardMode", newState);
|
||||
break;
|
||||
|
||||
case "EnableQuickPanel":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableQuickPanel", newState);
|
||||
break;
|
||||
|
||||
case "AutoEnterAnnotationModeWhenExitFoldMode":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAutoEnterAnnotationModeWhenExitFoldMode", newState);
|
||||
break;
|
||||
|
||||
case "AutoFoldAfterPPTSlideShow":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAutoFoldAfterPPTSlideShow", newState);
|
||||
break;
|
||||
|
||||
case "AutoFoldWhenExitWhiteboard":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAutoFoldWhenExitWhiteboard", newState);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="950" d:DesignWidth="640">
|
||||
<UserControl.Resources>
|
||||
<!-- 开关样式模板 -->
|
||||
<Style x:Key="ToggleSwitchStyle" TargetType="Border">
|
||||
<Setter Property="Width" Value="48"/>
|
||||
<Setter Property="Height" Value="25"/>
|
||||
@@ -22,7 +21,6 @@
|
||||
</UserControl.Resources>
|
||||
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="ScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
|
||||
<StackPanel Margin="60,12,60,24">
|
||||
<!-- 自动收纳设置 -->
|
||||
<Border BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="自动收纳" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
@@ -39,12 +37,11 @@
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<!-- 第一行 -->
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<Image Source="/Resources/Icons-png/EasiNote.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="希沃白板5" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInEasiNote" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -55,7 +52,7 @@
|
||||
<Image Source="/Resources/Icons-png/EasiCamera.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="希沃展台" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInEasiCamera" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -66,7 +63,7 @@
|
||||
<Image Source="/Resources/Icons-png/HiteBoard.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="鸿合白板" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInHiteTouchPro" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -77,19 +74,18 @@
|
||||
<Image Source="/Resources/Icons-png/EasiNote3.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="希沃白板3" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInEasiNote3" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<!-- 第二行 -->
|
||||
<StackPanel Grid.Row="1" Grid.Column="0" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<Image Source="/Resources/Icons-png/EasiNote3C.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="希沃轻白板" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInEasiNote3C" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -100,7 +96,7 @@
|
||||
<Image Source="/Resources/Icons-png/EasiNote5C.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="希沃轻白板5C" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInEasiNote5C" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -111,7 +107,7 @@
|
||||
<Image Source="/Resources/Icons-png/SeewoPinco.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="希沃品课" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInSeewoPincoTeacher" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -122,19 +118,18 @@
|
||||
<Image Source="/Resources/Icons-png/HiteCamera.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="鸿合展台" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInHiteCamera" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<!-- 第三行 -->
|
||||
<StackPanel Grid.Row="2" Grid.Column="0" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<Image Source="/Resources/Icons-png/HiteLightBoard.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="鸿合轻量白板" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInHiteLightBoard" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -145,7 +140,7 @@
|
||||
<Image Source="/Resources/Icons-png/WenXiang.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="文香白板" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInWxBoardMain" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -156,7 +151,7 @@
|
||||
<Image Source="/Resources/Icons-png/Whiteboard.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="微软白板" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInMSWhiteboard" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -167,19 +162,18 @@
|
||||
<Image Source="/Resources/Icons-png/AdmoxWhiteboard.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="安道白板" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInAdmoxWhiteboard" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<!-- 第四行 -->
|
||||
<StackPanel Grid.Row="3" Grid.Column="0" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<Image Source="/Resources/Icons-png/AdmoxBooth.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="安道展台" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInAdmoxBooth" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -190,7 +184,7 @@
|
||||
<Image Source="/Resources/Icons-png/YiYunWhiteboard.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="艺云白板" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInQPoint" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -201,7 +195,7 @@
|
||||
<Image Source="/Resources/Icons-png/YiYunVisualPresenter.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="艺云展台" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInYiYunVisualPresenter" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -212,7 +206,7 @@
|
||||
<Image Source="/Resources/Icons-png/MaxHubWhiteboard.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="MaxHub白板" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInMaxHubWhiteboard" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -227,7 +221,7 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="播放PPT时自动收纳" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInPPTSlideShow" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -241,7 +235,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后,执行自动收纳的软件在软件退出后不退出收纳模式,保持收纳状态" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchKeepFoldAfterSoftwareExit" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -255,7 +249,7 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="自动收纳忽略桌面EN5批注窗口" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInEasiNoteIgnoreDesktopAnno" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -269,7 +263,7 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="进入"中原旧白板"时自动收纳" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInOldZyBoard" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -279,7 +273,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 自动查杀设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="自动查杀" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Ink_Canvas;
|
||||
using Ink_Canvas;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using System;
|
||||
using System.Windows;
|
||||
@@ -8,9 +8,6 @@ using Application = System.Windows.Application;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
/// <summary>
|
||||
/// AutomationPanel.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class AutomationPanel : UserControl
|
||||
{
|
||||
private bool _isLoaded = false;
|
||||
@@ -24,16 +21,11 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
private void AutomationPanel_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LoadSettings();
|
||||
// 添加触摸支持
|
||||
EnableTouchSupport();
|
||||
// 应用主题
|
||||
ApplyTheme();
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载设置
|
||||
/// </summary>
|
||||
public void LoadSettings()
|
||||
{
|
||||
if (MainWindow.Settings == null || MainWindow.Settings.Automation == null)
|
||||
@@ -48,7 +40,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
var automation = MainWindow.Settings.Automation;
|
||||
|
||||
// 设置所有 ToggleSwitch 的状态
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAutoFoldInEasiNote"), automation.IsAutoFoldInEasiNote);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAutoFoldInEasiCamera"), automation.IsAutoFoldInEasiCamera);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAutoFoldInHiteTouchPro"), automation.IsAutoFoldInHiteTouchPro);
|
||||
@@ -81,29 +72,23 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"AutomationPanel 加载设置时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"AutomationPanel 加载设置时出�? {ex.Message}");
|
||||
}
|
||||
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找ToggleSwitch控件
|
||||
/// </summary>
|
||||
private Border FindToggleSwitch(string name)
|
||||
{
|
||||
return this.FindDescendantByName(name) as Border;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置 ToggleSwitch 状态
|
||||
/// </summary>
|
||||
private void SetToggleSwitchState(Border toggleSwitch, bool isOn)
|
||||
{
|
||||
if (toggleSwitch == null) return;
|
||||
toggleSwitch.Background = isOn
|
||||
? new SolidColorBrush(Color.FromRgb(53, 132, 228))
|
||||
: ThemeHelper.GetButtonBackgroundBrush();
|
||||
? ThemeHelper.GetToggleSwitchOnBackgroundBrush()
|
||||
: ThemeHelper.GetToggleSwitchOffBackgroundBrush();
|
||||
var innerBorder = toggleSwitch.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
@@ -111,36 +96,27 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ToggleSwitch 点击事件处理
|
||||
/// </summary>
|
||||
private void ToggleSwitch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
// 标记事件已处理,防止事件冒泡
|
||||
e.Handled = true;
|
||||
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
bool isOn = border.Background.ToString() == "#FF3584E4";
|
||||
bool isOn = ThemeHelper.IsToggleSwitchOn(border.Background);
|
||||
bool newState = !isOn;
|
||||
SetToggleSwitchState(border, newState);
|
||||
|
||||
// 通过 MainWindowSettingsHelper 调用 MainWindow 中的方法
|
||||
string toggleSwitchName = border.Name;
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled(toggleSwitchName, newState);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为面板中的所有交互控件启用触摸支持
|
||||
/// </summary>
|
||||
private void EnableTouchSupport()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 延迟执行,确保所有控件都已加载
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
MainWindowSettingsHelper.EnableTouchSupportForControls(this);
|
||||
@@ -148,7 +124,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"AutomationPanel 启用触摸支持时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"AutomationPanel 启用触摸支持时出�? {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,9 +144,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
@@ -179,7 +152,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"AutomationPanel 应用主题时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"AutomationPanel 应用主题时出�? {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="ComboBoxStyles.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<!-- 开关样式模板 -->
|
||||
<Style x:Key="ToggleSwitchStyle" TargetType="Border">
|
||||
<Setter Property="Width" Value="48"/>
|
||||
<Setter Property="Height" Value="25"/>
|
||||
@@ -27,7 +26,6 @@
|
||||
</UserControl.Resources>
|
||||
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="ScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
|
||||
<StackPanel Margin="60,12,60,24">
|
||||
<!-- 画笔和光标设置 -->
|
||||
<Border BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
@@ -36,7 +34,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="绘制时显示画笔光标" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchShowCursor" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="ShowCursor" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -50,7 +48,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后,触屏设备也将支持压感效果,适用于部分支持压感但无法被系统识别的触屏设备" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnablePressureTouchMode" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnablePressureTouchMode" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -64,7 +62,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后,将忽略所有设备的压感信息,使所有笔画具有统一的粗细。与压感触屏模式互斥" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchDisablePressure" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="DisablePressure" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -83,7 +81,7 @@
|
||||
<Border x:Name="EraserSizeSmall" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="EraserSize_Small" Margin="8,0,0,0" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="较小"/>
|
||||
</Border>
|
||||
<Border x:Name="EraserSizeMedium" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="EraserSize_Medium" Margin="8,0,0,0" MouseLeftButtonDown="OptionButton_Click">
|
||||
<Border x:Name="EraserSizeMedium" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="EraserSize_Medium" Margin="8,0,0,0" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="中等"/>
|
||||
</Border>
|
||||
<Border x:Name="EraserSizeLarge" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="EraserSize_Large" Margin="8,0,0,0" MouseLeftButtonDown="OptionButton_Click">
|
||||
@@ -97,7 +95,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 墨迹显示设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
@@ -106,7 +103,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后,进入 PPT 模式时未处于批注模式时不会显示墨迹" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchHideStrokeWhenSelecting" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="HideStrokeWhenSelecting" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -120,7 +117,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后,清空墨迹后将无法通过"撤销"功能恢复" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchClearCanvasAndClearTimeMachine" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="ClearCanvasAndClearTimeMachine" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -134,7 +131,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="清空画布时同时删除所有插入的图片" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchClearCanvasAlsoClearImages" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="ClearCanvasAlsoClearImages" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -148,7 +145,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="插入的图片大于1920x1080时自动压缩以节省内存" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchCompressPicturesUploaded" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="CompressPicturesUploaded" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -158,7 +155,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 形状和曲线设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
@@ -166,7 +162,7 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="保留双曲线渐近线" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Border x:Name="HyperbolaAsymptoteYes" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="HyperbolaAsymptote_Yes" MouseLeftButtonDown="OptionButton_Click">
|
||||
<Border x:Name="HyperbolaAsymptoteYes" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="HyperbolaAsymptote_Yes" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="是"/>
|
||||
</Border>
|
||||
<Border x:Name="HyperbolaAsymptoteNo" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="HyperbolaAsymptote_No" Margin="8,0,0,0" MouseLeftButtonDown="OptionButton_Click">
|
||||
@@ -177,108 +173,76 @@
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="绘制圆时显示圆心位置" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="绘制圆形时显示圆心标记" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchShowCircleCenter" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="ShowCircleCenter" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="使用WPF默认贝塞尔曲线平滑" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="使用WPF内置的曲线平滑算法" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchFitToCurve" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="FitToCurve" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="使用高级曲线平滑(推荐)" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="使用改进的贝塞尔曲线平滑算法,提供更好的绘制效果" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAdvancedBezierSmoothing" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="AdvancedBezierSmoothing" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启用墨迹渐隐功能" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="开启后墨迹不会绘制到画布上,而是保持湿墨迹状态,根据设置的渐隐时间自动消失" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableInkFade" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="EnableInkFade" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54" x:Name="InkFadeTimePanel" Visibility="Collapsed">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="墨迹渐隐时间" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="设置墨迹从绘制到完全消失的时间" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="InkFadeTimeSlider" Width="150" Minimum="1000" Maximum="10000" Value="3000" TickFrequency="1000" IsSnapToTickEnabled="True" ValueChanged="InkFadeTimeSlider_ValueChanged"/>
|
||||
<TextBlock x:Name="InkFadeTimeText" Text="3000ms" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 墨迹保存设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="墨迹保存设置" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="定时自动保存墨迹" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后将在设定时间间隔自动保存墨迹,仅在画布可见且有墨迹时才会保存" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableAutoSaveStrokes" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="EnableAutoSaveStrokes" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<StackPanel x:Name="AutoSaveIntervalPanel" Visibility="Collapsed">
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="保存间隔" HorizontalAlignment="Left" Margin="0,0,12,0"/>
|
||||
</StackPanel>
|
||||
<WrapPanel Orientation="Horizontal" Margin="0,0,15,0">
|
||||
<Border x:Name="AutoSaveStrokesInterval1MinBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="AutoSaveStrokesInterval_1" Margin="0,0,8,8" MouseLeftButtonDown="AutoSaveIntervalButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="1分钟"/>
|
||||
</Border>
|
||||
<Border x:Name="AutoSaveStrokesInterval3MinBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="AutoSaveStrokesInterval_3" Margin="0,0,8,8" MouseLeftButtonDown="AutoSaveIntervalButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="3分钟"/>
|
||||
</Border>
|
||||
<Border x:Name="AutoSaveStrokesInterval5MinBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="AutoSaveStrokesInterval_5" Margin="0,0,8,8" MouseLeftButtonDown="AutoSaveIntervalButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="5分钟"/>
|
||||
</Border>
|
||||
<Border x:Name="AutoSaveStrokesInterval10MinBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="AutoSaveStrokesInterval_10" Margin="0,0,8,8" MouseLeftButtonDown="AutoSaveIntervalButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="10分钟"/>
|
||||
</Border>
|
||||
<Border x:Name="AutoSaveStrokesInterval15MinBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="AutoSaveStrokesInterval_15" Margin="0,0,8,8" MouseLeftButtonDown="AutoSaveIntervalButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="15分钟"/>
|
||||
</Border>
|
||||
<Border x:Name="AutoSaveStrokesInterval30MinBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="AutoSaveStrokesInterval_30" Margin="0,0,8,8" MouseLeftButtonDown="AutoSaveIntervalButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="30分钟"/>
|
||||
</Border>
|
||||
<Border x:Name="AutoSaveStrokesInterval60MinBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="AutoSaveStrokesInterval_60" Margin="0,0,8,8" MouseLeftButtonDown="AutoSaveIntervalButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="60分钟"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<Grid MinHeight="54">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Vertical" Grid.Column="0" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0,8,0,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="墨迹全页面保存" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="开启后自动保存和手动保存墨迹时将以全屏模式保存。如果存在多个画布和墨迹,将把所有页面的墨迹按照每页为单位保存进一个压缩包中" HorizontalAlignment="Left" MaxWidth="450"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchSaveFullPageStrokes" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Grid.Column="1" VerticalAlignment="Top" Margin="0,8,15,8" Tag="SaveFullPageStrokes" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="保存为XML格式" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后保存墨迹时将使用XML格式(ISF格式),便于查看和编辑墨迹数据" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchSaveStrokesAsXML" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="SaveStrokesAsXML" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid MinHeight="54">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Vertical" Grid.Column="0" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0,8,0,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="自动保存幻灯片墨迹" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="开启后将在结束幻灯片放映时自动保存已有墨迹,并在下次打开时自动加载(文件名和幻灯片页数都要相同)" HorizontalAlignment="Left" MaxWidth="450"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoSaveStrokesInPowerPoint" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Grid.Column="1" VerticalAlignment="Top" Margin="0,8,15,8" Tag="AutoSaveStrokesInPowerPoint" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Ink_Canvas;
|
||||
using Ink_Canvas;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using System;
|
||||
using System.Linq;
|
||||
@@ -10,9 +10,6 @@ using System.Windows.Media;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
/// <summary>
|
||||
/// CanvasAndInkPanel.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class CanvasAndInkPanel : UserControl
|
||||
{
|
||||
private bool _isLoaded = false;
|
||||
@@ -26,21 +23,15 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
private void CanvasAndInkPanel_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LoadSettings();
|
||||
// 添加触摸支持
|
||||
EnableTouchSupport();
|
||||
// 应用主题
|
||||
ApplyTheme();
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为面板中的所有交互控件启用触摸支持
|
||||
/// </summary>
|
||||
private void EnableTouchSupport()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 延迟执行,确保所有控件都已加载
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
MainWindowSettingsHelper.EnableTouchSupportForControls(this);
|
||||
@@ -48,7 +39,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"CanvasAndInkPanel 启用触摸支持时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"CanvasAndInkPanel 启用触摸支持时出�? {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,9 +59,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载设置到UI
|
||||
/// </summary>
|
||||
public void LoadSettings()
|
||||
{
|
||||
if (MainWindow.Settings == null || MainWindow.Settings.Canvas == null) return;
|
||||
@@ -81,64 +69,53 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
var canvas = MainWindow.Settings.Canvas;
|
||||
|
||||
// 显示画笔光标
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchShowCursor"), canvas.IsShowCursor);
|
||||
|
||||
// 启用压感触屏模式
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnablePressureTouchMode"), canvas.EnablePressureTouchMode);
|
||||
|
||||
// 屏蔽压感
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchDisablePressure"), canvas.DisablePressure);
|
||||
|
||||
// 板擦橡皮大小
|
||||
SetOptionButtonState("EraserSize", canvas.EraserSize);
|
||||
|
||||
// 退出画板模式后隐藏墨迹
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchHideStrokeWhenSelecting"), canvas.HideStrokeWhenSelecting);
|
||||
|
||||
// 清空墨迹时删除墨迹历史记录
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchClearCanvasAndClearTimeMachine"), canvas.ClearCanvasAndClearTimeMachine);
|
||||
|
||||
// 清空画布时同时清空图片
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchClearCanvasAlsoClearImages"), canvas.ClearCanvasAlsoClearImages);
|
||||
|
||||
// 插入图片时自动压缩
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchCompressPicturesUploaded"), canvas.IsCompressPicturesUploaded);
|
||||
|
||||
// 保留双曲线渐近线
|
||||
SetOptionButtonState("HyperbolaAsymptote", (int)canvas.HyperbolaAsymptoteOption);
|
||||
|
||||
// 启用异步墨迹平滑
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchShowCircleCenter"), canvas.ShowCircleCenter);
|
||||
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchFitToCurve"), canvas.FitToCurve && !canvas.UseAdvancedBezierSmoothing);
|
||||
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAdvancedBezierSmoothing"), canvas.UseAdvancedBezierSmoothing);
|
||||
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableInkFade"), canvas.EnableInkFade);
|
||||
if (InkFadeTimePanel != null)
|
||||
{
|
||||
InkFadeTimePanel.Visibility = canvas.EnableInkFade ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
if (InkFadeTimeSlider != null)
|
||||
{
|
||||
InkFadeTimeSlider.Value = canvas.InkFadeTime;
|
||||
if (InkFadeTimeText != null)
|
||||
{
|
||||
InkFadeTimeText.Text = $"{canvas.InkFadeTime}ms";
|
||||
}
|
||||
}
|
||||
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchUseAsyncInkSmoothing"), canvas.UseAsyncInkSmoothing);
|
||||
|
||||
// 启用硬件加速
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchUseHardwareAcceleration"), canvas.UseHardwareAcceleration);
|
||||
|
||||
// 启用直线自动拉直
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAutoStraightenLine"), canvas.AutoStraightenLine);
|
||||
|
||||
// 启用高精度直线拉直
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchHighPrecisionLineStraighten"), canvas.HighPrecisionLineStraighten);
|
||||
|
||||
// 启用直线端点吸附
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchLineEndpointSnapping"), canvas.LineEndpointSnapping);
|
||||
|
||||
// 定时自动保存墨迹
|
||||
// 注意:这个设置可能在 Automation 或 Canvas 中,需要根据实际情况调整
|
||||
// SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableAutoSaveStrokes"), ...);
|
||||
|
||||
// 墨迹全页面保存
|
||||
// SetToggleSwitchState(FindToggleSwitch("ToggleSwitchSaveFullPageStrokes"), ...);
|
||||
|
||||
// 保存为XML格式
|
||||
// SetToggleSwitchState(FindToggleSwitch("ToggleSwitchSaveStrokesAsXML"), ...);
|
||||
|
||||
// 自动保存幻灯片墨迹
|
||||
if (MainWindow.Settings.PowerPointSettings != null)
|
||||
{
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAutoSaveStrokesInPowerPoint"),
|
||||
MainWindow.Settings.PowerPointSettings.IsAutoSaveStrokesInPowerPoint);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -148,23 +125,17 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找ToggleSwitch控件
|
||||
/// </summary>
|
||||
private Border FindToggleSwitch(string name)
|
||||
{
|
||||
return this.FindDescendantByName(name) as Border;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置ToggleSwitch状态
|
||||
/// </summary>
|
||||
private void SetToggleSwitchState(Border toggleSwitch, bool isOn)
|
||||
{
|
||||
if (toggleSwitch == null) return;
|
||||
toggleSwitch.Background = isOn
|
||||
? new SolidColorBrush(Color.FromRgb(53, 132, 228))
|
||||
: ThemeHelper.GetButtonBackgroundBrush();
|
||||
? ThemeHelper.GetToggleSwitchOnBackgroundBrush()
|
||||
: ThemeHelper.GetToggleSwitchOffBackgroundBrush();
|
||||
var innerBorder = toggleSwitch.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
@@ -172,9 +143,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置选项按钮状态
|
||||
/// </summary>
|
||||
private void SetOptionButtonState(string group, int selectedIndex)
|
||||
{
|
||||
var buttons = new[] { "VerySmall", "Small", "Medium", "Large", "VeryLarge" };
|
||||
@@ -182,36 +150,16 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
|
||||
string[] buttonNames = group == "EraserSize" ? buttons : hyperbolaButtons;
|
||||
|
||||
for (int i = 0; i < buttonNames.Length && i <= selectedIndex; i++)
|
||||
for (int i = 0; i < buttonNames.Length; i++)
|
||||
{
|
||||
var button = this.FindDescendantByName($"{group}{buttonNames[i]}") as Border;
|
||||
if (button != null)
|
||||
{
|
||||
if (i == selectedIndex)
|
||||
{
|
||||
button.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var textBlock = button.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Bold;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
button.Background = new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = button.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
}
|
||||
ThemeHelper.SetOptionButtonSelectedState(button, i == selectedIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ToggleSwitch点击事件处理
|
||||
/// </summary>
|
||||
private void ToggleSwitch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
@@ -219,7 +167,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
bool isOn = border.Background.ToString() == "#FF3584E4";
|
||||
bool isOn = ThemeHelper.IsToggleSwitchOn(border.Background);
|
||||
bool newState = !isOn;
|
||||
SetToggleSwitchState(border, newState);
|
||||
|
||||
@@ -232,14 +180,11 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
switch (tag)
|
||||
{
|
||||
case "ShowCursor":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchShowCursor", newState);
|
||||
break;
|
||||
|
||||
case "EnablePressureTouchMode":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnablePressureTouchMode", newState);
|
||||
// 处理互斥逻辑
|
||||
if (newState && canvas.DisablePressure)
|
||||
{
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchDisablePressure", false);
|
||||
@@ -248,9 +193,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
break;
|
||||
|
||||
case "DisablePressure":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchDisablePressure", newState);
|
||||
// 处理互斥逻辑
|
||||
if (newState && canvas.EnablePressureTouchMode)
|
||||
{
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnablePressureTouchMode", false);
|
||||
@@ -259,75 +202,73 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
break;
|
||||
|
||||
case "HideStrokeWhenSelecting":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchHideStrokeWhenSelecting", newState);
|
||||
break;
|
||||
|
||||
case "ClearCanvasAndClearTimeMachine":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchClearCanvasAndClearTimeMachine", newState);
|
||||
break;
|
||||
|
||||
case "ClearCanvasAlsoClearImages":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchClearCanvasAlsoClearImages", newState);
|
||||
break;
|
||||
|
||||
case "CompressPicturesUploaded":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchCompressPicturesUploaded", newState);
|
||||
break;
|
||||
|
||||
case "UseAsyncInkSmoothing":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAsyncInkSmoothing", newState);
|
||||
break;
|
||||
|
||||
case "UseHardwareAcceleration":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchHardwareAcceleration", newState);
|
||||
break;
|
||||
|
||||
case "AutoStraightenLine":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAutoStraightenLine", newState);
|
||||
break;
|
||||
|
||||
case "HighPrecisionLineStraighten":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchHighPrecisionLineStraighten", newState);
|
||||
break;
|
||||
|
||||
case "LineEndpointSnapping":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchLineEndpointSnapping", newState);
|
||||
break;
|
||||
|
||||
case "EnableAutoSaveStrokes":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableAutoSaveStrokes", newState);
|
||||
case "ShowCircleCenter":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchShowCircleCenter", newState);
|
||||
break;
|
||||
|
||||
case "SaveFullPageStrokes":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchSaveFullPageStrokes", newState);
|
||||
case "FitToCurve":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchFitToCurve", newState);
|
||||
if (newState)
|
||||
{
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAdvancedBezierSmoothing", false);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAdvancedBezierSmoothing"), false);
|
||||
}
|
||||
break;
|
||||
|
||||
case "SaveStrokesAsXML":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchSaveStrokesAsXML", newState);
|
||||
case "AdvancedBezierSmoothing":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAdvancedBezierSmoothing", newState);
|
||||
if (newState)
|
||||
{
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchFitToCurve", false);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchFitToCurve"), false);
|
||||
}
|
||||
break;
|
||||
|
||||
case "AutoSaveStrokesInPowerPoint":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAutoSaveStrokesInPowerPoint", newState);
|
||||
case "EnableInkFade":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableInkFade", newState);
|
||||
if (InkFadeTimePanel != null)
|
||||
{
|
||||
InkFadeTimePanel.Visibility = newState ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选项按钮点击事件处理
|
||||
/// </summary>
|
||||
private void OptionButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
@@ -344,7 +285,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
string group = parts[0];
|
||||
string value = parts[1];
|
||||
|
||||
// 清除同组其他按钮的选中状态
|
||||
var parent = border.Parent as Panel;
|
||||
if (parent != null)
|
||||
{
|
||||
@@ -355,24 +295,13 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
string childTag = childBorder.Tag?.ToString();
|
||||
if (!string.IsNullOrEmpty(childTag) && childTag.StartsWith(group + "_"))
|
||||
{
|
||||
childBorder.Background = new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = childBorder.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
ThemeHelper.SetOptionButtonSelectedState(childBorder, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 设置当前按钮为选中状态
|
||||
border.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var currentTextBlock = border.Child as TextBlock;
|
||||
if (currentTextBlock != null)
|
||||
{
|
||||
currentTextBlock.FontWeight = FontWeights.Bold;
|
||||
}
|
||||
ThemeHelper.SetOptionButtonSelectedState(border, true);
|
||||
|
||||
var canvas = MainWindow.Settings.Canvas;
|
||||
if (canvas == null) return;
|
||||
@@ -402,7 +331,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
eraserSize = 2;
|
||||
break;
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
var mainWindow = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow != null)
|
||||
{
|
||||
@@ -414,7 +342,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
canvas.EraserSize = eraserSize;
|
||||
@@ -440,7 +367,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
option = OptionalOperation.Ask;
|
||||
break;
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
var mainWindow2 = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow2 != null)
|
||||
{
|
||||
@@ -456,7 +382,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
canvas.HyperbolaAsymptoteOption = option;
|
||||
@@ -464,74 +389,35 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "AutoSaveStrokesInterval":
|
||||
// 调用 MainWindow 中的方法
|
||||
int interval = int.Parse(value);
|
||||
var mainWindow3 = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow3 != null)
|
||||
{
|
||||
var comboBox = mainWindow3.FindName("ComboBoxAutoSaveStrokesInterval") as System.Windows.Controls.ComboBox;
|
||||
if (comboBox != null)
|
||||
{
|
||||
// 查找对应的选项(根据 Tag 或 Content 匹配)
|
||||
foreach (System.Windows.Controls.ComboBoxItem item in comboBox.Items)
|
||||
{
|
||||
if (item.Tag != null && int.TryParse(item.Tag.ToString(), out int tagValue) && tagValue == interval)
|
||||
{
|
||||
comboBox.SelectedItem = item;
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChanged("ComboBoxAutoSaveStrokesInterval", item);
|
||||
break;
|
||||
}
|
||||
else if (item.Content != null && item.Content.ToString().Contains(interval.ToString()))
|
||||
{
|
||||
comboBox.SelectedItem = item;
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChanged("ComboBoxAutoSaveStrokesInterval", item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
if (MainWindow.Settings.Automation != null)
|
||||
{
|
||||
MainWindow.Settings.Automation.AutoSaveStrokesIntervalMinutes = interval;
|
||||
}
|
||||
}, "ComboBoxAutoSaveStrokesInterval");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 自动保存间隔选项按钮点击事件处理
|
||||
/// </summary>
|
||||
private void AutoSaveIntervalButton_Click(object sender, RoutedEventArgs e)
|
||||
private void InkFadeTimeSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
OptionButton_Click(sender, e);
|
||||
if (InkFadeTimeSlider != null && InkFadeTimeText != null)
|
||||
{
|
||||
int value = (int)InkFadeTimeSlider.Value;
|
||||
InkFadeTimeText.Text = $"{value}ms";
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("InkFadeTimeSlider", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Slider值变化事件处理
|
||||
/// </summary>
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
if (MainWindow.Settings?.Canvas != null)
|
||||
{
|
||||
var canvas = MainWindow.Settings.Canvas;
|
||||
SetOptionButtonState("EraserSize", canvas.EraserSize);
|
||||
SetOptionButtonState("HyperbolaAsymptote", (int)canvas.HyperbolaAsymptoteOption);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"CanvasAndInkPanel 应用主题时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"CanvasAndInkPanel 应用主题时出�? {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,8 @@
|
||||
PopupAnimation="Fade"
|
||||
IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
StaysOpen="False">
|
||||
<Border Background="White"
|
||||
<Border x:Name="PopupBorder"
|
||||
Background="White"
|
||||
BorderBrush="#e6e6e6"
|
||||
BorderThickness="1"
|
||||
CornerRadius="8"
|
||||
@@ -103,7 +104,6 @@
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<!-- ComboBoxItem样式 - 符合设置页面风格 -->
|
||||
<Style x:Key="ComboBoxItemStyle" TargetType="ComboBoxItem">
|
||||
<Setter Property="Background" Value="White"/>
|
||||
<Setter Property="Foreground" Value="#2e3436"/>
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
/// <summary>
|
||||
/// CrashActionPanel.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class CrashActionPanel : UserControl
|
||||
{
|
||||
public CrashActionPanel()
|
||||
@@ -29,10 +26,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
@@ -41,7 +34,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"CrashActionPanel 应用主题时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"CrashActionPanel 应用主题时出�? {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,8 +36,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
var sourceCollection = info.DragInfo.SourceCollection as ObservableCollection<FloatingBarItem>;
|
||||
|
||||
Trace.WriteLine(info.InsertIndex);
|
||||
|
||||
// 在同一个 ObservableCollection 中移动
|
||||
if (targetCollection.Equals(sourceCollection))
|
||||
{
|
||||
if (info.InsertIndex == 0)
|
||||
@@ -59,7 +57,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // 跨 ObservableCollection 移动
|
||||
{
|
||||
sourceCollection.Remove(info.Data as FloatingBarItem);
|
||||
targetCollection.Insert(info.InsertIndex, info.Data as FloatingBarItem);
|
||||
}
|
||||
@@ -95,14 +93,12 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
var targetCollection = info.TargetCollection as ObservableCollection<FloatingBarItem>;
|
||||
var sourceCollection = info.DragInfo.SourceCollection as ObservableCollection<FloatingBarItem>;
|
||||
|
||||
// 在同一个 ObservableCollection 中移动
|
||||
if (targetCollection.Equals(sourceCollection))
|
||||
{
|
||||
targetCollection.Insert(info.InsertIndex, info.Data as FloatingBarItem);
|
||||
}
|
||||
else
|
||||
{ // 跨 ObservableCollection 移动
|
||||
{
|
||||
sourceCollection.Remove(info.Data as FloatingBarItem);
|
||||
targetCollection.Insert(info.InsertIndex, info.Data as FloatingBarItem);
|
||||
}
|
||||
@@ -144,10 +140,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IconSource = FindResource("PenIcon") as DrawingImage,
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
@@ -156,7 +148,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"FloatingBarDnDSettingsPanel 应用主题时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"FloatingBarDnDSettingsPanel Ӧ������ʱ����: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="ComboBoxStyles.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<!-- 开关样式模板 -->
|
||||
<Style x:Key="ToggleSwitchStyle" TargetType="Border">
|
||||
<Setter Property="Width" Value="48"/>
|
||||
<Setter Property="Height" Value="25"/>
|
||||
@@ -27,7 +26,6 @@
|
||||
</UserControl.Resources>
|
||||
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="ScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
|
||||
<StackPanel Margin="60,12,60,24">
|
||||
<!-- 双指手势设置 -->
|
||||
<Border BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
@@ -36,7 +34,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后退出画板模式时自动关闭双指移动手势,进入白板模式时自动开启双指移动手势" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoSwitchTwoFingerGesture" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="AutoSwitchTwoFingerGesture" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -50,7 +48,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="允许选中墨迹后对墨迹进行双指或多指缩放操作" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableTwoFingerRotationOnSelection" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnableTwoFingerRotationOnSelection" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -60,7 +58,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 手掌擦设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
@@ -83,7 +80,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,0,0,12" Text="低敏感度:需要更大的触摸面积和更多触摸点,减少误判;高敏感度:更容易触发手掌擦,但可能误判手指" HorizontalAlignment="Left" TextWrapping="Wrap"/>
|
||||
</StackPanel>
|
||||
<WrapPanel Orientation="Horizontal" Margin="18,0,15,0">
|
||||
<Border x:Name="PalmEraserSensitivityLowBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="PalmEraserSensitivity_Low" Margin="0,0,8,0" MouseLeftButtonDown="OptionButton_Click">
|
||||
<Border x:Name="PalmEraserSensitivityLowBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="PalmEraserSensitivity_Low" Margin="0,0,8,0" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="低敏感度"/>
|
||||
</Border>
|
||||
<Border x:Name="PalmEraserSensitivityMediumBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="PalmEraserSensitivity_Medium" Margin="0,0,8,0" MouseLeftButtonDown="OptionButton_Click">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Ink_Canvas;
|
||||
using Ink_Canvas;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -9,9 +9,6 @@ using Application = System.Windows.Application;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
/// <summary>
|
||||
/// GesturesPanel.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class GesturesPanel : UserControl
|
||||
{
|
||||
private bool _isLoaded = false;
|
||||
@@ -25,21 +22,14 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
private void GesturesPanel_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LoadSettings();
|
||||
// 添加触摸支持
|
||||
EnableTouchSupport();
|
||||
// 应用主题
|
||||
ApplyTheme();
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为面板中的所有交互控件启用触摸支持
|
||||
/// </summary>
|
||||
private void EnableTouchSupport()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 延迟执行,确保所有控件都已加载
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
MainWindowSettingsHelper.EnableTouchSupportForControls(this);
|
||||
@@ -47,7 +37,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"GesturesPanel 启用触摸支持时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"GesturesPanel 启用触摸支持时出�? {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,10 +56,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载设置到UI
|
||||
/// </summary>
|
||||
public void LoadSettings()
|
||||
{
|
||||
if (MainWindow.Settings == null) return;
|
||||
@@ -78,51 +64,36 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
|
||||
try
|
||||
{
|
||||
// 进退白板模式自动开关双指移动功能
|
||||
if (MainWindow.Settings.Gesture != null)
|
||||
{
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAutoSwitchTwoFingerGesture"), MainWindow.Settings.Gesture.AutoSwitchTwoFingerGesture);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableTwoFingerRotationOnSelection"), MainWindow.Settings.Gesture.IsEnableTwoFingerRotationOnSelection);
|
||||
}
|
||||
|
||||
// 启用手掌擦
|
||||
if (MainWindow.Settings.Canvas != null)
|
||||
{
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnablePalmEraser"), MainWindow.Settings.Canvas.EnablePalmEraser);
|
||||
if (PalmEraserSensitivityPanel != null)
|
||||
{
|
||||
PalmEraserSensitivityPanel.Visibility = MainWindow.Settings.Canvas.EnablePalmEraser ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
|
||||
// 手掌擦敏感度
|
||||
SetOptionButtonState("PalmEraserSensitivity", MainWindow.Settings.Canvas.PalmEraserSensitivity);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"加载手势操作设置时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"加载手势操作设置时出�? {ex.Message}");
|
||||
}
|
||||
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找ToggleSwitch控件
|
||||
/// </summary>
|
||||
private Border FindToggleSwitch(string name)
|
||||
{
|
||||
return this.FindDescendantByName(name) as Border;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置ToggleSwitch状态
|
||||
/// </summary>
|
||||
private void SetToggleSwitchState(Border toggleSwitch, bool isOn)
|
||||
{
|
||||
if (toggleSwitch == null) return;
|
||||
toggleSwitch.Background = isOn
|
||||
? new SolidColorBrush(Color.FromRgb(53, 132, 228))
|
||||
: ThemeHelper.GetButtonBackgroundBrush();
|
||||
? ThemeHelper.GetToggleSwitchOnBackgroundBrush()
|
||||
: ThemeHelper.GetToggleSwitchOffBackgroundBrush();
|
||||
var innerBorder = toggleSwitch.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
@@ -130,9 +101,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置选项按钮状态
|
||||
/// </summary>
|
||||
private void SetOptionButtonState(string group, int selectedIndex)
|
||||
{
|
||||
var buttons = new Dictionary<string, string[]>
|
||||
@@ -149,31 +117,11 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
var button = this.FindDescendantByName($"{group}{buttonNames[i]}Border") as Border;
|
||||
if (button != null)
|
||||
{
|
||||
if (i == selectedIndex)
|
||||
{
|
||||
button.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var textBlock = button.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Bold;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
button.Background = new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = button.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
}
|
||||
ThemeHelper.SetOptionButtonSelectedState(button, i == selectedIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ToggleSwitch点击事件处理
|
||||
/// </summary>
|
||||
private void ToggleSwitch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
@@ -181,7 +129,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
bool isOn = border.Background.ToString() == "#FF3584E4";
|
||||
bool isOn = ThemeHelper.IsToggleSwitchOn(border.Background);
|
||||
bool newState = !isOn;
|
||||
SetToggleSwitchState(border, newState);
|
||||
|
||||
@@ -191,19 +139,15 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
switch (tag)
|
||||
{
|
||||
case "AutoSwitchTwoFingerGesture":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAutoSwitchTwoFingerGesture", newState);
|
||||
break;
|
||||
|
||||
case "EnableTwoFingerRotationOnSelection":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableTwoFingerRotationOnSelection", newState);
|
||||
break;
|
||||
|
||||
case "EnablePalmEraser":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnablePalmEraser", newState);
|
||||
// 更新UI状态
|
||||
if (PalmEraserSensitivityPanel != null)
|
||||
{
|
||||
PalmEraserSensitivityPanel.Visibility = newState ? Visibility.Visible : Visibility.Collapsed;
|
||||
@@ -212,9 +156,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选项按钮点击事件处理
|
||||
/// </summary>
|
||||
private void OptionButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
@@ -231,7 +172,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
string group = parts[0];
|
||||
string value = parts[1];
|
||||
|
||||
// 清除同组其他按钮的选中状态
|
||||
var parent = border.Parent as Panel;
|
||||
if (parent != null)
|
||||
{
|
||||
@@ -242,24 +182,13 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
string childTag = childBorder.Tag?.ToString();
|
||||
if (!string.IsNullOrEmpty(childTag) && childTag.StartsWith(group + "_"))
|
||||
{
|
||||
childBorder.Background = new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = childBorder.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
ThemeHelper.SetOptionButtonSelectedState(childBorder, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 设置当前按钮为选中状态
|
||||
border.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var currentTextBlock = border.Child as TextBlock;
|
||||
if (currentTextBlock != null)
|
||||
{
|
||||
currentTextBlock.FontWeight = FontWeights.Bold;
|
||||
}
|
||||
ThemeHelper.SetOptionButtonSelectedState(border, true);
|
||||
|
||||
switch (group)
|
||||
{
|
||||
@@ -280,7 +209,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
sensitivity = 0;
|
||||
break;
|
||||
}
|
||||
// 调用 MainWindow 中的方法(通过设置 ComboBox 的 SelectedIndex)
|
||||
var mainWindow = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow != null)
|
||||
{
|
||||
@@ -288,12 +216,10 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
if (comboBox != null && comboBox.Items.Count > sensitivity)
|
||||
{
|
||||
comboBox.SelectedIndex = sensitivity;
|
||||
// 触发 SelectionChanged 事件
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChanged("ComboBoxPalmEraserSensitivity", comboBox.Items[sensitivity]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
if (MainWindow.Settings.Canvas != null)
|
||||
@@ -307,18 +233,20 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
|
||||
if (MainWindow.Settings?.Canvas != null)
|
||||
{
|
||||
SetOptionButtonState("PalmEraserSensitivity", MainWindow.Settings.Canvas.PalmEraserSensitivity);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"GesturesPanel 应用主题时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"GesturesPanel 应用主题时出�? {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="950" d:DesignWidth="640">
|
||||
<UserControl.Resources>
|
||||
<!-- 开关样式模板 -->
|
||||
<Style x:Key="ToggleSwitchStyle" TargetType="Border">
|
||||
<Setter Property="Width" Value="48"/>
|
||||
<Setter Property="Height" Value="25"/>
|
||||
@@ -22,7 +21,6 @@
|
||||
</UserControl.Resources>
|
||||
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="ScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
|
||||
<StackPanel Margin="60,12,60,24">
|
||||
<!-- 墨迹识别主开关 -->
|
||||
<Border BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
@@ -30,8 +28,8 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启用墨迹识别" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="自动将手绘图形识别并转换为标准形状" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableInkToShape" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchEnableInkToShape" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnableInkToShape" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -41,7 +39,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 形状识别选项 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8" x:Name="InkRecognitionOptionsPanel">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
@@ -49,8 +46,8 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="阻止矫正后的矩形带有模拟压感值" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="矫正后的矩形不包含模拟压感信息" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableInkToShapeNoFakePressureRectangle" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchEnableInkToShapeNoFakePressureRectangle" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnableInkToShapeNoFakePressureRectangle" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -63,8 +60,8 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="阻止矫正后的三角形带有模拟压感值" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="矫正后的三角形不包含模拟压感信息" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableInkToShapeNoFakePressureTriangle" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchEnableInkToShapeNoFakePressureTriangle" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnableInkToShapeNoFakePressureTriangle" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -98,7 +95,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 直线识别设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
@@ -106,8 +102,8 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="直线自动拉直" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="当绘制的直线超过设定长度阈值时,将自动调整为完美直线" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoStraightenLine" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchAutoStraightenLine" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="AutoStraightenLine" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -150,8 +146,8 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="高精度直线拉直" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="高精度模式下,每隔10像素取一个计数点,获取更准确的平均值用于判断" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchHighPrecisionLineStraighten" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchHighPrecisionLineStraighten" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="HighPrecisionLineStraighten" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -164,8 +160,8 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="直线端点吸附" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="当绘制的直线端点靠近其他直线端点时,将自动吸附连接" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchLineEndpointSnapping" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchLineEndpointSnapping" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="LineEndpointSnapping" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Ink_Canvas;
|
||||
using Ink_Canvas;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using System;
|
||||
using System.Windows;
|
||||
@@ -6,9 +6,6 @@ using System.Windows.Controls;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
/// <summary>
|
||||
/// InkRecognitionPanel.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class InkRecognitionPanel : UserControl
|
||||
{
|
||||
private bool _isLoaded = false;
|
||||
@@ -22,16 +19,10 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
private void InkRecognitionPanel_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LoadSettings();
|
||||
// 添加触摸支持
|
||||
MainWindowSettingsHelper.EnableTouchSupportForControls(this);
|
||||
// 应用主题
|
||||
ApplyTheme();
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载设置
|
||||
/// </summary>
|
||||
public void LoadSettings()
|
||||
{
|
||||
if (MainWindow.Settings == null || MainWindow.Settings.Canvas == null || MainWindow.Settings.InkToShape == null) return;
|
||||
@@ -42,8 +33,12 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
var canvas = MainWindow.Settings.Canvas;
|
||||
var inkToShape = MainWindow.Settings.InkToShape;
|
||||
|
||||
// 自动拉直线阈值
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableInkToShape"), inkToShape.IsInkToShapeEnabled);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableInkToShapeNoFakePressureRectangle"), inkToShape.IsInkToShapeNoFakePressureRectangle);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableInkToShapeNoFakePressureTriangle"), inkToShape.IsInkToShapeNoFakePressureTriangle);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAutoStraightenLine"), canvas.AutoStraightenLine);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchHighPrecisionLineStraighten"), canvas.HighPrecisionLineStraighten);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchLineEndpointSnapping"), canvas.LineEndpointSnapping);
|
||||
if (AutoStraightenLineThresholdSlider != null)
|
||||
{
|
||||
AutoStraightenLineThresholdSlider.Value = canvas.AutoStraightenLineThreshold;
|
||||
@@ -52,8 +47,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
AutoStraightenLineThresholdText.Text = ((int)canvas.AutoStraightenLineThreshold).ToString();
|
||||
}
|
||||
}
|
||||
|
||||
// 灵敏度
|
||||
if (LineStraightenSensitivitySlider != null)
|
||||
{
|
||||
LineStraightenSensitivitySlider.Value = inkToShape.LineStraightenSensitivity;
|
||||
@@ -62,38 +55,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
LineStraightenSensitivityText.Text = inkToShape.LineStraightenSensitivity.ToString("F2");
|
||||
}
|
||||
}
|
||||
|
||||
// 高精度直线拉直
|
||||
var toggleSwitchHighPrecisionLineStraighten = this.FindDescendantByName("ToggleSwitchHighPrecisionLineStraighten") as Border;
|
||||
if (toggleSwitchHighPrecisionLineStraighten != null)
|
||||
{
|
||||
bool isOn = canvas.HighPrecisionLineStraighten;
|
||||
toggleSwitchHighPrecisionLineStraighten.Background = isOn
|
||||
? new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(53, 132, 228))
|
||||
: ThemeHelper.GetButtonBackgroundBrush();
|
||||
var innerBorder = toggleSwitchHighPrecisionLineStraighten.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
innerBorder.HorizontalAlignment = isOn ? HorizontalAlignment.Right : HorizontalAlignment.Left;
|
||||
}
|
||||
}
|
||||
|
||||
// 直线端点吸附
|
||||
var toggleSwitchLineEndpointSnapping = this.FindDescendantByName("ToggleSwitchLineEndpointSnapping") as Border;
|
||||
if (toggleSwitchLineEndpointSnapping != null)
|
||||
{
|
||||
bool isOn = canvas.LineEndpointSnapping;
|
||||
toggleSwitchLineEndpointSnapping.Background = isOn
|
||||
? new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(53, 132, 228))
|
||||
: ThemeHelper.GetButtonBackgroundBrush();
|
||||
var innerBorder = toggleSwitchLineEndpointSnapping.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
innerBorder.HorizontalAlignment = isOn ? HorizontalAlignment.Right : HorizontalAlignment.Left;
|
||||
}
|
||||
}
|
||||
|
||||
// 吸附距离
|
||||
if (LineEndpointSnappingThresholdSlider != null)
|
||||
{
|
||||
LineEndpointSnappingThresholdSlider.Value = canvas.LineEndpointSnappingThreshold;
|
||||
@@ -105,7 +66,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"加载墨迹识别设置时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"加载墨迹识别设置时出�? {ex.Message}");
|
||||
}
|
||||
|
||||
_isLoaded = true;
|
||||
@@ -126,10 +87,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
@@ -138,13 +95,66 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"InkRecognitionPanel 应用主题时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"InkRecognitionPanel 应用主题时出�? {ex.Message}");
|
||||
}
|
||||
}
|
||||
private Border FindToggleSwitch(string name)
|
||||
{
|
||||
return this.FindDescendantByName(name) as Border;
|
||||
}
|
||||
private void SetToggleSwitchState(Border toggleSwitch, bool isOn)
|
||||
{
|
||||
if (toggleSwitch == null) return;
|
||||
toggleSwitch.Background = isOn
|
||||
? ThemeHelper.GetToggleSwitchOnBackgroundBrush()
|
||||
: ThemeHelper.GetToggleSwitchOffBackgroundBrush();
|
||||
var innerBorder = toggleSwitch.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
innerBorder.HorizontalAlignment = isOn ? HorizontalAlignment.Right : HorizontalAlignment.Left;
|
||||
}
|
||||
}
|
||||
private void ToggleSwitch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
e.Handled = true;
|
||||
|
||||
/// <summary>
|
||||
/// Slider值变化事件处理
|
||||
/// </summary>
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
bool isOn = ThemeHelper.IsToggleSwitchOn(border.Background);
|
||||
bool newState = !isOn;
|
||||
SetToggleSwitchState(border, newState);
|
||||
string tag = border.Tag?.ToString();
|
||||
if (string.IsNullOrEmpty(tag)) return;
|
||||
|
||||
switch (tag)
|
||||
{
|
||||
case "EnableInkToShape":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableInkToShape", newState);
|
||||
break;
|
||||
|
||||
case "EnableInkToShapeNoFakePressureRectangle":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableInkToShapeNoFakePressureRectangle", newState);
|
||||
break;
|
||||
|
||||
case "EnableInkToShapeNoFakePressureTriangle":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableInkToShapeNoFakePressureTriangle", newState);
|
||||
break;
|
||||
|
||||
case "AutoStraightenLine":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAutoStraightenLine", newState);
|
||||
break;
|
||||
|
||||
case "HighPrecisionLineStraighten":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchHighPrecisionLineStraighten", newState);
|
||||
break;
|
||||
|
||||
case "LineEndpointSnapping":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchLineEndpointSnapping", newState);
|
||||
break;
|
||||
}
|
||||
}
|
||||
private void AutoStraightenLineThresholdSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="ComboBoxStyles.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<!-- 开关样式模板 -->
|
||||
<Style x:Key="ToggleSwitchStyle" TargetType="Border">
|
||||
<Setter Property="Width" Value="48"/>
|
||||
<Setter Property="Height" Value="25"/>
|
||||
@@ -27,7 +26,6 @@
|
||||
</UserControl.Resources>
|
||||
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="ScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
|
||||
<StackPanel Margin="60,12,60,24">
|
||||
<!-- 基本设置 -->
|
||||
<Border BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<Grid Height="54">
|
||||
@@ -36,7 +34,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在随机点名窗口中显示修改名单的按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchDisplayRandWindowNamesInputBtn" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="DisplayRandWindowNamesInputBtn" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -50,7 +48,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在随机点名窗口中显示随机抽和单次抽按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchShowRandomAndSingleDraw" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="ShowRandomAndSingleDraw" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -64,7 +62,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="启用快速抽人的悬浮按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableQuickDraw" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnableQuickDraw" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -78,7 +76,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="使用外部点名工具代替内置点名功能" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchExternalCaller" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="ExternalCaller" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -92,7 +90,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="选择外部点名工具的类型" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<WrapPanel Orientation="Horizontal" Margin="0,0,0,8">
|
||||
<Border x:Name="ExternalCallerTypeClassIslandBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="ExternalCallerType_ClassIsland" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<Border x:Name="ExternalCallerTypeClassIslandBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="ExternalCallerType_ClassIsland" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="ClassIsland点名"/>
|
||||
</Border>
|
||||
<Border x:Name="ExternalCallerTypeSecRandomBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="ExternalCallerType_SecRandom" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
@@ -106,7 +104,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 窗口设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<Grid Height="54">
|
||||
@@ -133,7 +130,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 新点名UI设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="新点名UI设置" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
@@ -143,7 +139,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="使用新的点名界面设计" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchUseNewRollCallUI" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="UseNewRollCallUI" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -157,7 +153,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="使用机器学习算法避免重复抽取相同的人" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableMLAvoidance" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnableMLAvoidance" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -191,7 +187,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 背景设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="点名窗口背景设置(仅老版点名UI有效)" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
@@ -201,7 +196,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="选择点名窗口的背景" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<WrapPanel Orientation="Horizontal">
|
||||
<Border x:Name="PickNameBackgroundDefaultBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="PickNameBackground_Default" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<Border x:Name="PickNameBackgroundDefaultBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="PickNameBackground_Default" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="默认背景"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Ink_Canvas;
|
||||
using Ink_Canvas;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -10,9 +10,6 @@ using Application = System.Windows.Application;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
/// <summary>
|
||||
/// LuckyRandomPanel.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class LuckyRandomPanel : UserControl
|
||||
{
|
||||
private bool _isLoaded = false;
|
||||
@@ -26,21 +23,15 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
private void LuckyRandomPanel_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LoadSettings();
|
||||
// 添加触摸支持
|
||||
EnableTouchSupport();
|
||||
// 应用主题
|
||||
ApplyTheme();
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为面板中的所有交互控件启用触摸支持
|
||||
/// </summary>
|
||||
private void EnableTouchSupport()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 延迟执行,确保所有控件都已加载
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
MainWindowSettingsHelper.EnableTouchSupportForControls(this);
|
||||
@@ -48,7 +39,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"LuckyRandomPanel 启用触摸支持时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"LuckyRandomPanel 启用触摸支持时出�? {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,9 +59,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载设置到UI
|
||||
/// </summary>
|
||||
public void LoadSettings()
|
||||
{
|
||||
if (MainWindow.Settings == null || MainWindow.Settings.RandSettings == null) return;
|
||||
@@ -81,22 +69,16 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
var randSettings = MainWindow.Settings.RandSettings;
|
||||
|
||||
// 显示修改随机点名名单的按钮
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchDisplayRandWindowNamesInputBtn"), randSettings.DisplayRandWindowNamesInputBtn);
|
||||
|
||||
// 启用随机抽和单次抽按钮
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchShowRandomAndSingleDraw"), randSettings.ShowRandomAndSingleDraw);
|
||||
|
||||
// 启用快抽悬浮按钮
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableQuickDraw"), randSettings.EnableQuickDraw);
|
||||
|
||||
// 直接调用外部点名
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchExternalCaller"), randSettings.DirectCallCiRand);
|
||||
|
||||
// 点名类型
|
||||
SetOptionButtonState("ExternalCallerType", randSettings.ExternalCallerType);
|
||||
|
||||
// 单次抽人窗口关闭延迟
|
||||
if (RandWindowOnceCloseLatencySlider != null)
|
||||
{
|
||||
RandWindowOnceCloseLatencySlider.Value = randSettings.RandWindowOnceCloseLatency;
|
||||
@@ -106,7 +88,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
// 单次随机点名人数上限
|
||||
if (RandWindowOnceMaxStudentsSlider != null)
|
||||
{
|
||||
RandWindowOnceMaxStudentsSlider.Value = randSettings.RandWindowOnceMaxStudents;
|
||||
@@ -116,13 +97,10 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
// 启用新点名UI
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchUseNewRollCallUI"), randSettings.UseNewRollCallUI);
|
||||
|
||||
// 启用机器学习避免重复
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableMLAvoidance"), randSettings.EnableMLAvoidance);
|
||||
|
||||
// 避免重复历史记录数量
|
||||
if (MLAvoidanceHistorySlider != null)
|
||||
{
|
||||
MLAvoidanceHistorySlider.Value = randSettings.MLAvoidanceHistoryCount;
|
||||
@@ -132,7 +110,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
// 避免重复权重
|
||||
if (MLAvoidanceWeightSlider != null)
|
||||
{
|
||||
MLAvoidanceWeightSlider.Value = randSettings.MLAvoidanceWeight;
|
||||
@@ -142,34 +119,27 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
// 背景选择
|
||||
SetOptionButtonState("PickNameBackground", randSettings.SelectedBackgroundIndex);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"加载幸运随机设置时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"加载幸运随机设置时出�? {ex.Message}");
|
||||
}
|
||||
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找ToggleSwitch控件
|
||||
/// </summary>
|
||||
private Border FindToggleSwitch(string name)
|
||||
{
|
||||
return this.FindDescendantByName(name) as Border;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置ToggleSwitch状态
|
||||
/// </summary>
|
||||
private void SetToggleSwitchState(Border toggleSwitch, bool isOn)
|
||||
{
|
||||
if (toggleSwitch == null) return;
|
||||
toggleSwitch.Background = isOn
|
||||
? new SolidColorBrush(Color.FromRgb(53, 132, 228))
|
||||
: ThemeHelper.GetButtonBackgroundBrush();
|
||||
? ThemeHelper.GetToggleSwitchOnBackgroundBrush()
|
||||
: ThemeHelper.GetToggleSwitchOffBackgroundBrush();
|
||||
var innerBorder = toggleSwitch.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
@@ -177,9 +147,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置选项按钮状态
|
||||
/// </summary>
|
||||
private void SetOptionButtonState(string group, int selectedIndex)
|
||||
{
|
||||
var buttons = new Dictionary<string, string[]>
|
||||
@@ -197,32 +164,11 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
var button = this.FindDescendantByName($"{group}{buttonNames[i]}Border") as Border;
|
||||
if (button != null)
|
||||
{
|
||||
if (i == selectedIndex)
|
||||
{
|
||||
// 使用主题适配的选中背景颜色
|
||||
button.Background = ThemeHelper.GetSelectedBackgroundBrush();
|
||||
var textBlock = button.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Bold;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
button.Background = new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = button.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
}
|
||||
ThemeHelper.SetOptionButtonSelectedState(button, i == selectedIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ToggleSwitch点击事件处理
|
||||
/// </summary>
|
||||
private void ToggleSwitch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
@@ -230,7 +176,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
bool isOn = border.Background.ToString() == "#FF3584E4";
|
||||
bool isOn = ThemeHelper.IsToggleSwitchOn(border.Background);
|
||||
bool newState = !isOn;
|
||||
SetToggleSwitchState(border, newState);
|
||||
|
||||
@@ -243,40 +189,31 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
switch (tag)
|
||||
{
|
||||
case "DisplayRandWindowNamesInputBtn":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchDisplayRandWindowNamesInputBtn", newState);
|
||||
break;
|
||||
|
||||
case "ShowRandomAndSingleDraw":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchShowRandomAndSingleDraw", newState);
|
||||
break;
|
||||
|
||||
case "EnableQuickDraw":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableQuickDraw", newState);
|
||||
break;
|
||||
|
||||
case "ExternalCaller":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchExternalCaller", newState);
|
||||
break;
|
||||
|
||||
case "UseNewRollCallUI":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchUseNewRollCallUI", newState);
|
||||
break;
|
||||
|
||||
case "EnableMLAvoidance":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableMLAvoidance", newState);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选项按钮点击事件处理
|
||||
/// </summary>
|
||||
private void OptionButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
@@ -293,7 +230,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
string group = parts[0];
|
||||
string value = parts[1];
|
||||
|
||||
// 清除同组其他按钮的选中状态
|
||||
var parent = border.Parent as Panel;
|
||||
if (parent != null)
|
||||
{
|
||||
@@ -304,24 +240,13 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
string childTag = childBorder.Tag?.ToString();
|
||||
if (!string.IsNullOrEmpty(childTag) && childTag.StartsWith(group + "_"))
|
||||
{
|
||||
childBorder.Background = new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = childBorder.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
ThemeHelper.SetOptionButtonSelectedState(childBorder, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 设置当前按钮为选中状态,使用主题适配的选中背景颜色
|
||||
border.Background = ThemeHelper.GetSelectedBackgroundBrush();
|
||||
var currentTextBlock = border.Child as TextBlock;
|
||||
if (currentTextBlock != null)
|
||||
{
|
||||
currentTextBlock.FontWeight = FontWeights.Bold;
|
||||
}
|
||||
ThemeHelper.SetOptionButtonSelectedState(border, true);
|
||||
|
||||
var randSettings = MainWindow.Settings.RandSettings;
|
||||
if (randSettings == null) return;
|
||||
@@ -345,7 +270,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
callerType = 0;
|
||||
break;
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
var mainWindow = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow != null)
|
||||
{
|
||||
@@ -357,7 +281,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
randSettings.ExternalCallerType = callerType;
|
||||
@@ -367,18 +290,14 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
break;
|
||||
|
||||
case "PickNameBackground":
|
||||
// 背景选择逻辑 - 这个设置可能没有对应的方法,直接更新
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
randSettings.SelectedBackgroundIndex = 0; // 默认背景
|
||||
randSettings.SelectedBackgroundIndex = 0;
|
||||
}, "PickNameBackground");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Slider值变化事件处理
|
||||
/// </summary>
|
||||
private void RandWindowOnceCloseLatencySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
@@ -386,7 +305,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
double value = RandWindowOnceCloseLatencySlider.Value;
|
||||
RandWindowOnceCloseLatencyText.Text = $"{value:F1}s";
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("RandWindowOnceCloseLatencySlider", value);
|
||||
}
|
||||
}
|
||||
@@ -398,7 +316,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
double value = RandWindowOnceMaxStudentsSlider.Value;
|
||||
RandWindowOnceMaxStudentsText.Text = ((int)value).ToString();
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("RandWindowOnceMaxStudentsSlider", value);
|
||||
}
|
||||
}
|
||||
@@ -410,7 +327,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
double value = MLAvoidanceHistorySlider.Value;
|
||||
MLAvoidanceHistoryText.Text = ((int)value).ToString();
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("MLAvoidanceHistorySlider", value);
|
||||
}
|
||||
}
|
||||
@@ -422,23 +338,25 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
double value = MLAvoidanceWeightSlider.Value;
|
||||
MLAvoidanceWeightText.Text = $"{(value * 100):F0}%";
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("MLAvoidanceWeightSlider", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
if (MainWindow.Settings?.RandSettings != null)
|
||||
{
|
||||
var randSettings = MainWindow.Settings.RandSettings;
|
||||
SetOptionButtonState("ExternalCallerType", randSettings.ExternalCallerType);
|
||||
SetOptionButtonState("PickNameBackground", randSettings.SelectedBackgroundIndex);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"LuckyRandomPanel 应用主题时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"LuckyRandomPanel 应用主题时出�? {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Ink_Canvas;
|
||||
using Ink_Canvas;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -7,25 +7,16 @@ using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using Media = System.Windows.Media;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
/// <summary>
|
||||
/// 辅助类:用于在新设置面板中调用 MainWindow 中已有的设置处理方法
|
||||
/// </summary>
|
||||
public static class MainWindowSettingsHelper
|
||||
{
|
||||
private static MainWindow GetMainWindow()
|
||||
{
|
||||
return Application.Current.MainWindow as MainWindow;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 调用 MainWindow 中的方法
|
||||
/// </summary>
|
||||
public static void InvokeMainWindowMethod(string methodName, params object[] parameters)
|
||||
{
|
||||
try
|
||||
@@ -44,22 +35,15 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
System.Diagnostics.Debug.WriteLine($"调用 MainWindow 方法 {methodName} 失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 调用 MainWindow 中的 ToggleSwitch 事件处理方法
|
||||
/// </summary>
|
||||
public static void InvokeToggleSwitchToggled(string toggleSwitchName, bool isOn)
|
||||
{
|
||||
try
|
||||
{
|
||||
var mainWindow = GetMainWindow();
|
||||
if (mainWindow == null) return;
|
||||
|
||||
// 获取 MainWindow 中的 ToggleSwitch 控件
|
||||
var toggleSwitch = mainWindow.FindName(toggleSwitchName);
|
||||
if (toggleSwitch == null)
|
||||
{
|
||||
// 如果找不到控件,尝试通过反射设置属性
|
||||
var property = mainWindow.GetType().GetProperty(toggleSwitchName, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
|
||||
if (property != null && property.PropertyType.Name.Contains("ToggleSwitch"))
|
||||
{
|
||||
@@ -75,13 +59,9 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件和属性,先更新设置
|
||||
// 对于自动收纳相关的设置,直接更新 Settings 对象
|
||||
if (toggleSwitchName.StartsWith("ToggleSwitchAutoFold") || toggleSwitchName == "ToggleSwitchKeepFoldAfterSoftwareExit")
|
||||
{
|
||||
UpdateAutoFoldSetting(toggleSwitchName, isOn);
|
||||
|
||||
// 对于需要调用 StartOrStoptimerCheckAutoFold 的设置
|
||||
if (toggleSwitchName.StartsWith("ToggleSwitchAutoFold") &&
|
||||
!toggleSwitchName.Contains("PPTSlideShow") &&
|
||||
!toggleSwitchName.Contains("KeepFold") &&
|
||||
@@ -96,21 +76,16 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
System.Diagnostics.Debug.WriteLine($"调用 StartOrStoptimerCheckAutoFold 失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
// 通知新设置面板同步状态
|
||||
NotifySettingsPanelsSyncState(toggleSwitchName);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 尝试触发事件(可能通过反射调用)
|
||||
var toggledMethodName = toggleSwitchName + "_Toggled";
|
||||
var method = mainWindow.GetType().GetMethod(toggledMethodName, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
|
||||
if (method != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 尝试直接调用方法
|
||||
InvokeMainWindowMethod(toggledMethodName, null, new RoutedEventArgs());
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -118,28 +93,18 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
System.Diagnostics.Debug.WriteLine($"调用 {toggledMethodName} 失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
// 通知新设置面板同步状态
|
||||
NotifySettingsPanelsSyncState(toggleSwitchName);
|
||||
return;
|
||||
}
|
||||
|
||||
// 设置 ToggleSwitch 的 IsOn 属性
|
||||
var toggleSwitchType = toggleSwitch.GetType();
|
||||
var isOnProp = toggleSwitchType.GetProperty("IsOn");
|
||||
if (isOnProp != null)
|
||||
{
|
||||
isOnProp.SetValue(toggleSwitch, isOn);
|
||||
}
|
||||
|
||||
// 触发 Toggled 事件
|
||||
var toggledMethodName2 = toggleSwitchName + "_Toggled";
|
||||
InvokeMainWindowMethod(toggledMethodName2, toggleSwitch, new RoutedEventArgs());
|
||||
|
||||
// 通知新设置面板同步状态
|
||||
NotifySettingsPanelsSyncState(toggleSwitchName);
|
||||
|
||||
// 检查是否需要更新主题
|
||||
NotifyThemeUpdateIfNeeded(toggleSwitchName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -147,17 +112,11 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
System.Diagnostics.Debug.WriteLine($"调用 ToggleSwitch {toggleSwitchName} 失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新自动收纳相关的设置
|
||||
/// </summary>
|
||||
private static void UpdateAutoFoldSetting(string toggleSwitchName, bool isOn)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (MainWindow.Settings?.Automation == null) return;
|
||||
|
||||
// 根据 ToggleSwitch 名称映射到对应的设置属性
|
||||
var settingMap = new Dictionary<string, Action<bool>>
|
||||
{
|
||||
{ "ToggleSwitchAutoFoldInEasiNote", (val) => MainWindow.Settings.Automation.IsAutoFoldInEasiNote = val },
|
||||
@@ -193,44 +152,28 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
System.Diagnostics.Debug.WriteLine($"更新自动收纳设置失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ToggleSwitch 包装类,用于在找不到实际控件时模拟 ToggleSwitch
|
||||
/// </summary>
|
||||
private class ToggleSwitchWrapper
|
||||
{
|
||||
public bool IsOn { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 调用 MainWindow 中的 ComboBox 事件处理方法
|
||||
/// </summary>
|
||||
public static void InvokeComboBoxSelectionChanged(string comboBoxName, object selectedItem)
|
||||
{
|
||||
try
|
||||
{
|
||||
var mainWindow = GetMainWindow();
|
||||
if (mainWindow == null) return;
|
||||
|
||||
// 获取 MainWindow 中的 ComboBox 控件
|
||||
var comboBox = mainWindow.FindName(comboBoxName) as System.Windows.Controls.ComboBox;
|
||||
if (comboBox != null)
|
||||
{
|
||||
comboBox.SelectedItem = selectedItem;
|
||||
|
||||
// 触发 SelectionChanged 事件
|
||||
var selectionChangedMethodName = comboBoxName + "_SelectionChanged";
|
||||
InvokeMainWindowMethod(selectionChangedMethodName, comboBox, new System.Windows.Controls.SelectionChangedEventArgs(
|
||||
System.Windows.Controls.Primitives.Selector.SelectionChangedEvent,
|
||||
new System.Collections.IList[0],
|
||||
new System.Collections.IList[0]));
|
||||
}
|
||||
|
||||
// 通知新设置面板同步状态
|
||||
NotifySettingsPanelsSyncState(comboBoxName);
|
||||
|
||||
// 检查是否需要更新主题
|
||||
NotifyThemeUpdateIfNeeded(comboBoxName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -238,34 +181,22 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
System.Diagnostics.Debug.WriteLine($"调用 ComboBox {comboBoxName} 失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 调用 MainWindow 中的 Slider 事件处理方法
|
||||
/// </summary>
|
||||
public static void InvokeSliderValueChanged(string sliderName, double value)
|
||||
{
|
||||
try
|
||||
{
|
||||
var mainWindow = GetMainWindow();
|
||||
if (mainWindow == null) return;
|
||||
|
||||
// 获取 MainWindow 中的 Slider 控件
|
||||
var slider = mainWindow.FindName(sliderName) as System.Windows.Controls.Slider;
|
||||
if (slider != null)
|
||||
{
|
||||
var oldValue = slider.Value;
|
||||
slider.Value = value;
|
||||
|
||||
// 触发 ValueChanged 事件
|
||||
var valueChangedMethodName = sliderName + "_ValueChanged";
|
||||
InvokeMainWindowMethod(valueChangedMethodName, slider,
|
||||
new System.Windows.RoutedPropertyChangedEventArgs<double>(oldValue, value));
|
||||
}
|
||||
|
||||
// 通知新设置面板同步状态
|
||||
NotifySettingsPanelsSyncState(sliderName);
|
||||
|
||||
// 检查是否需要更新主题(某些Slider可能影响UI外观)
|
||||
NotifyThemeUpdateIfNeeded(sliderName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -273,24 +204,16 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
System.Diagnostics.Debug.WriteLine($"调用 Slider {sliderName} 失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 调用 MainWindow 中的 CheckBox 事件处理方法
|
||||
/// </summary>
|
||||
public static void InvokeCheckBoxCheckedChanged(string checkBoxName, bool isChecked)
|
||||
{
|
||||
try
|
||||
{
|
||||
var mainWindow = GetMainWindow();
|
||||
if (mainWindow == null) return;
|
||||
|
||||
// 获取 MainWindow 中的 CheckBox 控件
|
||||
var checkBox = mainWindow.FindName(checkBoxName) as System.Windows.Controls.CheckBox;
|
||||
if (checkBox != null)
|
||||
{
|
||||
checkBox.IsChecked = isChecked;
|
||||
|
||||
// 尝试多种可能的方法名
|
||||
var methodNames = new[]
|
||||
{
|
||||
checkBoxName + "_IsCheckChanged",
|
||||
@@ -315,20 +238,10 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
System.Diagnostics.Debug.WriteLine($"调用 CheckBox {checkBoxName} 失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 安全地修改设置并保存,优先调用 MainWindow 中的事件处理方法
|
||||
/// 如果找不到对应的事件处理方法,则直接修改设置并保存
|
||||
/// </summary>
|
||||
/// <param name="action">设置修改的 Action,例如:() => MainWindow.Settings.Startup.IsAutoUpdate = true</param>
|
||||
/// <param name="eventHandlerName">可选:要调用的 MainWindow 事件处理方法名(如 "ToggleSwitchIsAutoUpdate_Toggled")</param>
|
||||
/// <param name="controlName">可选:控件名称,用于状态同步(如 "ToggleSwitchIsAutoUpdate")</param>
|
||||
/// <param name="eventHandlerParams">可选:事件处理方法的参数</param>
|
||||
public static void UpdateSettingSafely(Action action, string eventHandlerName = null, string controlName = null, params object[] eventHandlerParams)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 如果提供了事件处理方法名,优先调用
|
||||
if (!string.IsNullOrEmpty(eventHandlerName))
|
||||
{
|
||||
var mainWindow = GetMainWindow();
|
||||
@@ -337,10 +250,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
var method = mainWindow.GetType().GetMethod(eventHandlerName, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
|
||||
if (method != null)
|
||||
{
|
||||
// 调用事件处理方法(它会自动保存设置并触发状态同步)
|
||||
method.Invoke(mainWindow, eventHandlerParams);
|
||||
|
||||
// 如果提供了控件名称,确保状态同步
|
||||
if (!string.IsNullOrEmpty(controlName))
|
||||
{
|
||||
NotifySettingsPanelsSyncState(controlName);
|
||||
@@ -349,12 +259,8 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 如果没有事件处理方法或调用失败,直接修改设置并保存
|
||||
action?.Invoke();
|
||||
MainWindow.SaveSettingsToFile();
|
||||
|
||||
// 如果提供了控件名称,通知面板同步状态
|
||||
if (!string.IsNullOrEmpty(controlName))
|
||||
{
|
||||
NotifySettingsPanelsSyncState(controlName);
|
||||
@@ -365,20 +271,12 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
System.Diagnostics.Debug.WriteLine($"更新设置失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 直接修改设置属性并保存(用于没有对应事件处理方法的设置项)
|
||||
/// </summary>
|
||||
/// <param name="action">设置修改的 Action</param>
|
||||
/// <param name="controlName">可选:控件名称,用于状态同步(如 "ToggleSwitchIsAutoUpdate")</param>
|
||||
public static void UpdateSettingDirectly(Action action, string controlName = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
action?.Invoke();
|
||||
MainWindow.SaveSettingsToFile();
|
||||
|
||||
// 如果提供了控件名称,通知面板同步状态
|
||||
if (!string.IsNullOrEmpty(controlName))
|
||||
{
|
||||
NotifySettingsPanelsSyncState(controlName);
|
||||
@@ -389,31 +287,21 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
System.Diagnostics.Debug.WriteLine($"直接更新设置失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 调用 MainWindow 中的 TextBox 事件处理方法
|
||||
/// </summary>
|
||||
public static void InvokeTextBoxTextChanged(string textBoxName, string text)
|
||||
{
|
||||
try
|
||||
{
|
||||
var mainWindow = GetMainWindow();
|
||||
if (mainWindow == null) return;
|
||||
|
||||
// 获取 MainWindow 中的 TextBox 控件
|
||||
var textBox = mainWindow.FindName(textBoxName) as System.Windows.Controls.TextBox;
|
||||
if (textBox != null)
|
||||
{
|
||||
textBox.Text = text;
|
||||
|
||||
// 触发 TextChanged 事件
|
||||
var textChangedMethodName = textBoxName + "_TextChanged";
|
||||
InvokeMainWindowMethod(textChangedMethodName, textBox, new System.Windows.Controls.TextChangedEventArgs(
|
||||
System.Windows.Controls.Primitives.TextBoxBase.TextChangedEvent,
|
||||
System.Windows.Controls.UndoAction.None));
|
||||
}
|
||||
|
||||
// 通知新设置面板同步状态
|
||||
NotifySettingsPanelsSyncState(textBoxName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -421,35 +309,26 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
System.Diagnostics.Debug.WriteLine($"调用 TextBox {textBoxName} 失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通知所有新设置面板同步指定控件的状态
|
||||
/// </summary>
|
||||
public static void NotifySettingsPanelsSyncState(string controlName)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 延迟执行,确保设置已经保存
|
||||
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
// 查找所有打开的设置窗口
|
||||
foreach (Window window in Application.Current.Windows)
|
||||
{
|
||||
if (window.GetType().Name == "SettingsWindow")
|
||||
{
|
||||
// 根据控件名称确定需要同步的面板
|
||||
var panelToSync = GetPanelForControl(controlName);
|
||||
|
||||
if (panelToSync != null)
|
||||
{
|
||||
// 获取对应的面板属性
|
||||
var panelProp = window.GetType().GetProperty(panelToSync, BindingFlags.Public | BindingFlags.Instance);
|
||||
if (panelProp != null)
|
||||
{
|
||||
var panel = panelProp.GetValue(window) as System.Windows.Controls.UserControl;
|
||||
if (panel != null)
|
||||
{
|
||||
// 调用 LoadSettings 方法重新加载设置
|
||||
var loadMethod = panel.GetType().GetMethod("LoadSettings",
|
||||
BindingFlags.Public | BindingFlags.Instance);
|
||||
if (loadMethod != null)
|
||||
@@ -461,37 +340,28 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果无法确定具体面板,则同步所有面板(保守策略)
|
||||
SyncAllPanels(window);
|
||||
}
|
||||
break; // 通常只有一个设置窗口
|
||||
break;
|
||||
}
|
||||
}
|
||||
}), System.Windows.Threading.DispatcherPriority.Background);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"通知设置面板同步状态失败: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"通知设置面板同步状态失�? {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据控件名称获取对应的面板名称
|
||||
/// </summary>
|
||||
private static string GetPanelForControl(string controlName)
|
||||
{
|
||||
// 定义控件名称到面板名称的映射
|
||||
var controlToPanel = new Dictionary<string, string>
|
||||
{
|
||||
// StartupPanel
|
||||
{ "ToggleSwitchIsAutoUpdate", "StartupPanel" },
|
||||
{ "ToggleSwitchIsAutoUpdateWithSilence", "StartupPanel" },
|
||||
{ "ToggleSwitchRunAtStartup", "StartupPanel" },
|
||||
{ "ToggleSwitchFoldAtStartup", "StartupPanel" },
|
||||
{ "AutoUpdateWithSilenceStartTimeComboBox", "StartupPanel" },
|
||||
{ "AutoUpdateWithSilenceEndTimeComboBox", "StartupPanel" },
|
||||
|
||||
// ThemePanel
|
||||
{ "ComboBoxTheme", "ThemePanel" },
|
||||
{ "ToggleSwitchEnableSplashScreen", "ThemePanel" },
|
||||
{ "ComboBoxSplashScreenStyle", "ThemePanel" },
|
||||
@@ -505,34 +375,24 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{ "ViewboxFloatingBarScaleTransformValueSlider", "ThemePanel" },
|
||||
{ "ViewboxFloatingBarOpacityValueSlider", "ThemePanel" },
|
||||
{ "ViewboxFloatingBarOpacityInPPTValueSlider", "ThemePanel" },
|
||||
|
||||
// PowerPointPanel
|
||||
{ "ToggleSwitchSupportPowerPoint", "PowerPointPanel" },
|
||||
{ "ToggleSwitchShowPPTButton", "PowerPointPanel" },
|
||||
{ "ToggleSwitchEnablePPTButtonPageClickable", "PowerPointPanel" },
|
||||
{ "ToggleSwitchShowCanvasAtNewSlideShow", "PowerPointPanel" },
|
||||
{ "PPTButtonLeftPositionValueSlider", "PowerPointPanel" },
|
||||
{ "PPTButtonRightPositionValueSlider", "PowerPointPanel" },
|
||||
|
||||
// GesturesPanel
|
||||
{ "ToggleSwitchEnableTwoFingerRotationOnSelection", "GesturesPanel" },
|
||||
{ "ToggleSwitchEnablePalmEraser", "GesturesPanel" },
|
||||
{ "ComboBoxPalmEraserSensitivity", "GesturesPanel" },
|
||||
|
||||
// CanvasAndInkPanel
|
||||
{ "ToggleSwitchShowCursor", "CanvasAndInkPanel" },
|
||||
{ "ToggleSwitchDisablePressure", "CanvasAndInkPanel" },
|
||||
{ "ToggleSwitchEnablePressureTouchMode", "CanvasAndInkPanel" },
|
||||
{ "ComboBoxEraserSize", "CanvasAndInkPanel" },
|
||||
{ "ComboBoxHyperbolaAsymptoteOption", "CanvasAndInkPanel" },
|
||||
{ "ComboBoxAutoSaveStrokesInterval", "CanvasAndInkPanel" },
|
||||
|
||||
// SnapshotPanel
|
||||
{ "AutoSavedStrokesLocation", "SnapshotPanel" },
|
||||
{ "ComboBoxAutoDelSavedFilesDaysThreshold", "SnapshotPanel" },
|
||||
{ "ToggleSwitchAutoDelSavedFiles", "SnapshotPanel" },
|
||||
|
||||
// AdvancedPanel
|
||||
{ "ComboBoxAutoBackupInterval", "AdvancedPanel" },
|
||||
{ "ToggleSwitchIsQuadIR", "AdvancedPanel" },
|
||||
{ "ToggleSwitchIsLogEnabled", "AdvancedPanel" },
|
||||
@@ -546,8 +406,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{ "ToggleSwitchIsEnableResolutionChangeDetection", "AdvancedPanel" },
|
||||
{ "ToggleSwitchIsAutoBackupBeforeUpdate", "AdvancedPanel" },
|
||||
{ "ToggleSwitchIsAutoBackupEnabled", "AdvancedPanel" },
|
||||
|
||||
// LuckyRandomPanel
|
||||
{ "ToggleSwitchDisplayRandWindowNamesInputBtn", "LuckyRandomPanel" },
|
||||
{ "ToggleSwitchShowRandomAndSingleDraw", "LuckyRandomPanel" },
|
||||
{ "ToggleSwitchEnableQuickDraw", "LuckyRandomPanel" },
|
||||
@@ -556,8 +414,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{ "RandWindowOnceCloseLatencySlider", "LuckyRandomPanel" },
|
||||
{ "RandWindowOnceMaxStudentsSlider", "LuckyRandomPanel" },
|
||||
};
|
||||
|
||||
// 查找匹配的面板
|
||||
foreach (var kvp in controlToPanel)
|
||||
{
|
||||
if (controlName.Contains(kvp.Key) || kvp.Key.Contains(controlName))
|
||||
@@ -568,15 +424,10 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 同步所有面板的状态(保守策略)
|
||||
/// </summary>
|
||||
private static void SyncAllPanels(Window settingsWindow)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 获取所有面板属性
|
||||
var panelProperties = settingsWindow.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)
|
||||
.Where(p => p.PropertyType.Name.EndsWith("Panel") &&
|
||||
p.PropertyType.IsSubclassOf(typeof(System.Windows.Controls.UserControl)));
|
||||
@@ -588,7 +439,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
var panel = panelProp.GetValue(settingsWindow) as System.Windows.Controls.UserControl;
|
||||
if (panel != null)
|
||||
{
|
||||
// 调用 LoadSettings 方法
|
||||
var loadMethod = panel.GetType().GetMethod("LoadSettings",
|
||||
BindingFlags.Public | BindingFlags.Instance);
|
||||
if (loadMethod != null)
|
||||
@@ -599,51 +449,41 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"同步面板 {panelProp.Name} 状态失败: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"同步面板 {panelProp.Name} 状态失�? {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"同步所有面板状态失败: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"同步所有面板状态失�? {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查并通知设置窗口更新主题(如果设置变化可能影响主题)
|
||||
/// </summary>
|
||||
/// <param name="controlName">控件名称,用于判断是否是主题相关的设置</param>
|
||||
public static void NotifyThemeUpdateIfNeeded(string controlName)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(controlName)) return;
|
||||
|
||||
// 定义可能影响主题的控件名称列表(扩展版)
|
||||
var themeRelatedControls = new[]
|
||||
{
|
||||
"ComboBoxTheme", // 主题选择
|
||||
"ToggleSwitchEnableTrayIcon", // 托盘图标(可能影响图标颜色)
|
||||
"ComboBoxFloatingBarImg", // 浮动栏图标
|
||||
"ComboBoxUnFoldBtnImg", // 展开按钮图标
|
||||
"ComboBoxSplashScreenStyle", // 启动画面样式
|
||||
"ToggleSwitchEnableSplashScreen", // 启动画面开关
|
||||
"ViewboxFloatingBarScaleTransformValueSlider", // 浮动栏缩放(可能影响UI)
|
||||
"ViewboxFloatingBarOpacityValueSlider", // 浮动栏透明度
|
||||
"ViewboxFloatingBarOpacityInPPTValueSlider", // PPT中浮动栏透明度
|
||||
"UnFoldBtnImg", // 展开按钮图标(选项按钮)
|
||||
"FloatingBarImg", // 浮动栏图标(选项按钮)
|
||||
"Theme" // 主题(选项按钮)
|
||||
"ComboBoxTheme",
|
||||
"ToggleSwitchEnableTrayIcon",
|
||||
"ComboBoxFloatingBarImg",
|
||||
"ComboBoxUnFoldBtnImg",
|
||||
"ComboBoxSplashScreenStyle",
|
||||
"ToggleSwitchEnableSplashScreen",
|
||||
"ViewboxFloatingBarScaleTransformValueSlider",
|
||||
"ViewboxFloatingBarOpacityValueSlider",
|
||||
"ViewboxFloatingBarOpacityInPPTValueSlider",
|
||||
"UnFoldBtnImg",
|
||||
"FloatingBarImg",
|
||||
"Theme"
|
||||
};
|
||||
|
||||
// 检查是否是主题相关的设置(使用更灵活的匹配)
|
||||
bool isThemeRelated = false;
|
||||
string controlNameLower = controlName.ToLower();
|
||||
|
||||
foreach (var themeControl in themeRelatedControls)
|
||||
{
|
||||
string themeControlLower = themeControl.ToLower();
|
||||
// 检查是否包含或匹配
|
||||
if (controlNameLower.Contains(themeControlLower) ||
|
||||
themeControlLower.Contains(controlNameLower) ||
|
||||
controlNameLower == themeControlLower)
|
||||
@@ -655,10 +495,8 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
|
||||
if (isThemeRelated)
|
||||
{
|
||||
// 延迟通知,确保设置已保存
|
||||
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
// 通知设置窗口更新主题
|
||||
NotifySettingsWindowThemeUpdate();
|
||||
}), System.Windows.Threading.DispatcherPriority.Background);
|
||||
}
|
||||
@@ -668,29 +506,20 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
System.Diagnostics.Debug.WriteLine($"通知主题更新失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通知设置窗口更新所有面板的主题
|
||||
/// </summary>
|
||||
private static void NotifySettingsWindowThemeUpdate()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 查找所有打开的设置窗口
|
||||
foreach (Window window in Application.Current.Windows)
|
||||
{
|
||||
// 使用类型名称匹配,因为 SettingsWindow 在不同的命名空间中
|
||||
if (window.GetType().Name == "SettingsWindow")
|
||||
{
|
||||
// 使用反射调用 ApplyThemeToAllPanels 方法
|
||||
var method = window.GetType().GetMethod("ApplyThemeToAllPanels",
|
||||
BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
|
||||
if (method != null)
|
||||
{
|
||||
method.Invoke(window, null);
|
||||
}
|
||||
|
||||
// 同时调用 ApplyTheme 方法更新窗口本身
|
||||
var applyThemeMethod = window.GetType().GetMethod("ApplyTheme",
|
||||
BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
|
||||
if (applyThemeMethod != null)
|
||||
@@ -698,7 +527,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
applyThemeMethod.Invoke(window, null);
|
||||
}
|
||||
|
||||
break; // 通常只有一个设置窗口
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -707,37 +536,20 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
System.Diagnostics.Debug.WriteLine($"通知设置窗口主题更新失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 强制更新所有设置面板的主题(公共方法,可在外部调用)
|
||||
/// </summary>
|
||||
public static void ForceUpdateAllPanelsTheme()
|
||||
{
|
||||
NotifySettingsWindowThemeUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 调用 MainWindow 中的 ComboBox 事件处理方法(增强版,支持主题更新通知)
|
||||
/// </summary>
|
||||
public static void InvokeComboBoxSelectionChangedWithThemeCheck(string comboBoxName, object selectedItem)
|
||||
{
|
||||
InvokeComboBoxSelectionChanged(comboBoxName, selectedItem);
|
||||
NotifyThemeUpdateIfNeeded(comboBoxName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 调用 MainWindow 中的 ToggleSwitch 事件处理方法(增强版,支持主题更新通知)
|
||||
/// </summary>
|
||||
public static void InvokeToggleSwitchToggledWithThemeCheck(string toggleSwitchName, bool isOn)
|
||||
{
|
||||
InvokeToggleSwitchToggled(toggleSwitchName, isOn);
|
||||
NotifyThemeUpdateIfNeeded(toggleSwitchName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为控件树中的所有交互控件启用触摸支持(公共方法,可在外部调用)
|
||||
/// </summary>
|
||||
/// <param name="parent">父控件</param>
|
||||
public static void EnableTouchSupportForControls(DependencyObject parent)
|
||||
{
|
||||
if (parent == null) return;
|
||||
@@ -745,16 +557,11 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
for (int i = 0; i < Media.VisualTreeHelper.GetChildrenCount(parent); i++)
|
||||
{
|
||||
var child = Media.VisualTreeHelper.GetChild(parent, i);
|
||||
|
||||
// 为 Border 控件(ToggleSwitch、选项按钮等)启用触摸支持
|
||||
if (child is Border border)
|
||||
{
|
||||
// 检查是否是交互控件(有 Tag 或 Cursor 为 Hand)
|
||||
if (border.Tag != null || border.Cursor == Cursors.Hand)
|
||||
{
|
||||
border.IsManipulationEnabled = true;
|
||||
|
||||
// 添加触摸事件支持,将触摸事件转换为鼠标事件
|
||||
border.TouchDown += (s, e) =>
|
||||
{
|
||||
var touchPoint = e.GetTouchPoint(border);
|
||||
@@ -767,8 +574,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
border.CaptureTouch(e.TouchDevice);
|
||||
e.Handled = true;
|
||||
};
|
||||
|
||||
// 添加触摸释放事件
|
||||
border.TouchUp += (s, e) =>
|
||||
{
|
||||
border.ReleaseTouchCapture(e.TouchDevice);
|
||||
@@ -776,38 +581,30 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
};
|
||||
}
|
||||
}
|
||||
// 为 Button 控件启用触摸支持
|
||||
else if (child is Button button)
|
||||
{
|
||||
button.IsManipulationEnabled = true;
|
||||
}
|
||||
// 为 ComboBox 启用触摸支持
|
||||
else if (child is ComboBox comboBox)
|
||||
{
|
||||
comboBox.IsManipulationEnabled = true;
|
||||
}
|
||||
// 为 Slider 启用触摸支持
|
||||
else if (child is Slider slider)
|
||||
{
|
||||
slider.IsManipulationEnabled = true;
|
||||
}
|
||||
// 为 TextBox 启用触摸支持
|
||||
else if (child is TextBox textBox)
|
||||
{
|
||||
textBox.IsManipulationEnabled = true;
|
||||
}
|
||||
// 为 CheckBox 启用触摸支持
|
||||
else if (child is CheckBox checkBox)
|
||||
{
|
||||
checkBox.IsManipulationEnabled = true;
|
||||
}
|
||||
// 为 RadioButton 启用触摸支持
|
||||
else if (child is RadioButton radioButton)
|
||||
{
|
||||
radioButton.IsManipulationEnabled = true;
|
||||
}
|
||||
|
||||
// 递归处理子元素
|
||||
EnableTouchSupportForControls(child);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="ComboBoxStyles.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<!-- 开关样式模板 -->
|
||||
<Style x:Key="ToggleSwitchStyle" TargetType="Border">
|
||||
<Setter Property="Width" Value="48"/>
|
||||
<Setter Property="Height" Value="25"/>
|
||||
@@ -27,7 +26,6 @@
|
||||
</UserControl.Resources>
|
||||
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="ScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
|
||||
<StackPanel Margin="60,12,60,24">
|
||||
<!-- PPT联动设置 -->
|
||||
<Border BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="此部分的设置项将会在幻灯片播放时使用,优先级高于其他设置项"
|
||||
@@ -38,7 +36,7 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="Microsoft PowerPoint 支持" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchSupportPowerPoint" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="SupportPowerPoint" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -52,7 +50,7 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="PowerPoint 联动增强" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchPowerPointEnhancement" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="PowerPointEnhancement" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -66,7 +64,7 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="WPS 支持" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchSupportWPS" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="SupportWPS" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -80,7 +78,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="关闭后将不会自动查杀WPP残留进程,可能导致WPP关闭卡顿或无法彻底退出" HorizontalAlignment="Left" MaxWidth="450"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableWppProcessKill" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnableWppProcessKill" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -112,41 +110,60 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- PPT翻页按钮设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="PPT翻页按钮" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
<Border ClipToBounds="True" Width="324" Height="182" Margin="0,0,0,12">
|
||||
<Grid>
|
||||
<Image Source="Resources/PresentationExample/page.jpg" Width="324" Height="182" Stretch="Fill"/>
|
||||
<Image x:Name="PPTBtnPreviewToolbar" Source="Resources/PresentationExample/toolbar.png" Height="16"
|
||||
VerticalAlignment="Bottom" HorizontalAlignment="Center" Stretch="Uniform"/>
|
||||
<Image x:Name="PPTBtnPreviewLS" Source="Resources/PresentationExample/sidebar-white.png" Width="10" Height="30"
|
||||
<Image x:Name="PPTBtnPreviewBackground" Width="324" Height="182" Stretch="Fill">
|
||||
<Image.Source>
|
||||
<BitmapImage UriSource="pack://application:,,,/Resources/PresentationExample/page.jpg"/>
|
||||
</Image.Source>
|
||||
</Image>
|
||||
<Image x:Name="PPTBtnPreviewToolbar" Height="16"
|
||||
VerticalAlignment="Bottom" HorizontalAlignment="Center" Stretch="Uniform">
|
||||
<Image.Source>
|
||||
<BitmapImage UriSource="pack://application:,,,/Resources/PresentationExample/toolbar.png"/>
|
||||
</Image.Source>
|
||||
</Image>
|
||||
<Image x:Name="PPTBtnPreviewLS" Width="10" Height="30"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Left" RenderTransformOrigin="0.5,0.5" Stretch="Fill">
|
||||
<Image.Source>
|
||||
<BitmapImage UriSource="pack://application:,,,/Resources/PresentationExample/sidebar-white.png"/>
|
||||
</Image.Source>
|
||||
<Image.RenderTransform>
|
||||
<TransformGroup>
|
||||
<TranslateTransform x:Name="PPTBtnPreviewLSTransform"/>
|
||||
</TransformGroup>
|
||||
</Image.RenderTransform>
|
||||
</Image>
|
||||
<Image x:Name="PPTBtnPreviewRS" Source="Resources/PresentationExample/sidebar-white.png" Width="10" Height="30"
|
||||
<Image x:Name="PPTBtnPreviewRS" Width="10" Height="30"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Right" RenderTransformOrigin="0.5,0.5" Stretch="Fill">
|
||||
<Image.Source>
|
||||
<BitmapImage UriSource="pack://application:,,,/Resources/PresentationExample/sidebar-white.png"/>
|
||||
</Image.Source>
|
||||
<Image.RenderTransform>
|
||||
<TransformGroup>
|
||||
<TranslateTransform x:Name="PPTBtnPreviewRSTransform"/>
|
||||
</TransformGroup>
|
||||
</Image.RenderTransform>
|
||||
</Image>
|
||||
<Image x:Name="PPTBtnPreviewLB" Source="Resources/PresentationExample/bottombar-white.png" Height="10" Width="30"
|
||||
<Image x:Name="PPTBtnPreviewLB" Height="10" Width="30"
|
||||
VerticalAlignment="Bottom" HorizontalAlignment="Left" RenderTransformOrigin="0.5,0.5" Stretch="Fill">
|
||||
<Image.Source>
|
||||
<BitmapImage UriSource="pack://application:,,,/Resources/PresentationExample/bottombar-white.png"/>
|
||||
</Image.Source>
|
||||
<Image.RenderTransform>
|
||||
<TransformGroup>
|
||||
<TranslateTransform x:Name="PPTBtnPreviewLBTransform"/>
|
||||
</TransformGroup>
|
||||
</Image.RenderTransform>
|
||||
</Image>
|
||||
<Image x:Name="PPTBtnPreviewRB" Source="Resources/PresentationExample/bottombar-white.png" Height="10" Width="30"
|
||||
<Image x:Name="PPTBtnPreviewRB" Height="10" Width="30"
|
||||
VerticalAlignment="Bottom" HorizontalAlignment="Right" RenderTransformOrigin="0.5,0.5" Stretch="Fill">
|
||||
<Image.Source>
|
||||
<BitmapImage UriSource="pack://application:,,,/Resources/PresentationExample/bottombar-white.png"/>
|
||||
</Image.Source>
|
||||
<Image.RenderTransform>
|
||||
<TransformGroup>
|
||||
<TranslateTransform x:Name="PPTBtnPreviewRBTransform"/>
|
||||
@@ -161,7 +178,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在PPT放映模式下显示翻页控制按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchShowPPTButton" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="ShowPPTButton" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -355,7 +372,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="开启后,点击页码按钮可以唤起PowerPoint自带的网格缩略图视图。WPS不支持该功能" HorizontalAlignment="Left" MaxWidth="450"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnablePPTButtonPageClickable" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Grid.Column="1" VerticalAlignment="Top" Margin="0,8,0,0" Tag="EnablePPTButtonPageClickable" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -373,7 +390,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="开启后,长按PPT翻页按钮可以连续翻页,提高翻页效率" HorizontalAlignment="Left" MaxWidth="450"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnablePPTButtonLongPressPageTurn" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Grid.Column="1" VerticalAlignment="Top" Margin="0,8,0,0" Tag="EnablePPTButtonLongPressPageTurn" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -391,7 +408,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="开启后,点击下一页按钮时会跳过幻灯片之间的转场动画,直接跳转到下一张幻灯片。不会影响幻灯片内的元素动画" HorizontalAlignment="Left" MaxWidth="450"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchSkipAnimationsWhenGoNext" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Grid.Column="1" VerticalAlignment="Top" Margin="0,8,0,0" Tag="SkipAnimationsWhenGoNext" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -402,7 +419,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- PPT放映模式设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<Grid Height="54">
|
||||
@@ -411,7 +427,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="进入PPT放映时自动切换到批注模式" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchShowCanvasAtNewSlideShow" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="ShowCanvasAtNewSlideShow" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -443,7 +459,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在幻灯片模式下允许使用双指手势" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableTwoFingerGestureInPresentationMode" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnableTwoFingerGestureInPresentationMode" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -457,7 +473,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="在幻灯片放映模式下,当画板无墨迹时,使用手指左右滑动即可控制幻灯片翻页" HorizontalAlignment="Left" MaxWidth="450"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableFingerGestureSlideShowControl" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnableFingerGestureSlideShowControl" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -471,7 +487,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后在 PPT 放映模式下也显示手势按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchShowGestureButtonInSlideShow" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="ShowGestureButtonInSlideShow" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -481,7 +497,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- PPT时间胶囊设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<Grid Height="54">
|
||||
@@ -490,7 +505,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="开启后在 PPT 放映模式下显示时间胶囊,可替代最小化计时器窗口" HorizontalAlignment="Left" MaxWidth="450"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnablePPTTimeCapsule" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnablePPTTimeCapsule" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -504,7 +519,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="选择时间胶囊在屏幕上的显示位置" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<WrapPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Border x:Name="PPTTimeCapsulePositionTopLeftBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="PPTTimeCapsulePosition_TopLeft" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<Border x:Name="PPTTimeCapsulePositionTopLeftBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="PPTTimeCapsulePosition_TopLeft" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="左上角"/>
|
||||
</Border>
|
||||
<Border x:Name="PPTTimeCapsulePositionTopRightBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="PPTTimeCapsulePosition_TopRight" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
@@ -518,7 +533,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- PPT提示设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<Grid Height="54">
|
||||
@@ -527,7 +541,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后会记录上次播放的页数,点击"是"后会自动跳转" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchNotifyPreviousPage" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="NotifyPreviousPage" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -541,7 +555,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="进入PPT放映时自动跳转到第一页" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAlwaysGoToFirstPageOnReenter" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="AlwaysGoToFirstPageOnReenter" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -555,7 +569,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在播放隐藏幻灯片时显示提示" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchNotifyHiddenPage" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="NotifyHiddenPage" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -569,7 +583,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在PPT自动播放时显示提示" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchNotifyAutoPlayPresentation" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="NotifyAutoPlayPresentation" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Ink_Canvas;
|
||||
using Ink_Canvas;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -9,9 +9,6 @@ using System.Windows.Media;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
/// <summary>
|
||||
/// PowerPointPanel.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class PowerPointPanel : UserControl
|
||||
{
|
||||
private bool _isLoaded = false;
|
||||
@@ -25,21 +22,15 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
private void PowerPointPanel_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LoadSettings();
|
||||
// 添加触摸支持
|
||||
EnableTouchSupport();
|
||||
// 应用主题
|
||||
ApplyTheme();
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为面板中的所有交互控件启用触摸支持
|
||||
/// </summary>
|
||||
private void EnableTouchSupport()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 延迟执行,确保所有控件都已加载
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
MainWindowSettingsHelper.EnableTouchSupportForControls(this);
|
||||
@@ -47,7 +38,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"PowerPointPanel 启用触摸支持时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"PowerPointPanel 启用触摸支持时出�? {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,9 +58,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载设置到UI
|
||||
/// </summary>
|
||||
public void LoadSettings()
|
||||
{
|
||||
if (MainWindow.Settings == null || MainWindow.Settings.PowerPointSettings == null) return;
|
||||
@@ -80,26 +68,20 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
var pptSettings = MainWindow.Settings.PowerPointSettings;
|
||||
|
||||
// Microsoft PowerPoint 支持
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchSupportPowerPoint"), pptSettings.PowerPointSupport);
|
||||
|
||||
// PowerPoint 联动增强
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchPowerPointEnhancement"), pptSettings.EnablePowerPointEnhancement);
|
||||
|
||||
// WPS 支持
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchSupportWPS"), pptSettings.IsSupportWPS);
|
||||
|
||||
// WPP进程查杀
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableWppProcessKill"), pptSettings.EnableWppProcessKill);
|
||||
|
||||
// 在 PPT 模式下显示翻页按钮
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchShowPPTButton"), pptSettings.ShowPPTButton);
|
||||
if (PPTButtonSettingsPanel != null)
|
||||
{
|
||||
PPTButtonSettingsPanel.Visibility = pptSettings.ShowPPTButton ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
|
||||
// PPT按钮显示选项
|
||||
var dops = pptSettings.PPTButtonsDisplayOption.ToString();
|
||||
var dopsc = dops.ToCharArray();
|
||||
if (dopsc.Length >= 4)
|
||||
@@ -110,7 +92,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
if (CheckboxEnableRSPPTButton != null) CheckboxEnableRSPPTButton.IsChecked = dopsc[3] == '2';
|
||||
}
|
||||
|
||||
// 按钮位置
|
||||
if (PPTButtonLeftPositionValueSlider != null)
|
||||
{
|
||||
PPTButtonLeftPositionValueSlider.Value = pptSettings.PPTLSButtonPosition;
|
||||
@@ -144,7 +125,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
// 两侧按钮选项
|
||||
var sops = pptSettings.PPTSButtonsOption.ToString();
|
||||
var sopsc = sops.ToCharArray();
|
||||
if (sopsc.Length >= 3)
|
||||
@@ -154,7 +134,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
if (CheckboxSPPTBlackBackground != null) CheckboxSPPTBlackBackground.IsChecked = sopsc[2] == '2';
|
||||
}
|
||||
|
||||
// 左下右下按钮选项
|
||||
var bops = pptSettings.PPTBButtonsOption.ToString();
|
||||
var bopsc = bops.ToCharArray();
|
||||
if (bopsc.Length >= 3)
|
||||
@@ -164,7 +143,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
if (CheckboxBPPTBlackBackground != null) CheckboxBPPTBlackBackground.IsChecked = bopsc[2] == '2';
|
||||
}
|
||||
|
||||
// 按钮透明度
|
||||
if (PPTLSButtonOpacityValueSlider != null)
|
||||
{
|
||||
PPTLSButtonOpacityValueSlider.Value = pptSettings.PPTLSButtonOpacity > 0 ? pptSettings.PPTLSButtonOpacity : 0.5;
|
||||
@@ -198,70 +176,56 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
// PPT 页码按钮可点击
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnablePPTButtonPageClickable"), pptSettings.EnablePPTButtonPageClickable);
|
||||
|
||||
// PPT 翻页按钮长按翻页
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnablePPTButtonLongPressPageTurn"), pptSettings.EnablePPTButtonLongPressPageTurn);
|
||||
|
||||
// 点击翻页时跳过转场动画
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchSkipAnimationsWhenGoNext"), pptSettings.SkipAnimationsWhenGoNext);
|
||||
|
||||
// 进入 PPT 放映时自动进入批注模式
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchShowCanvasAtNewSlideShow"), pptSettings.IsShowCanvasAtNewSlideShow);
|
||||
|
||||
// 允许幻灯片模式下的双指手势
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableTwoFingerGestureInPresentationMode"), pptSettings.IsEnableTwoFingerGestureInPresentationMode);
|
||||
|
||||
// 允许使用手指手势进行幻灯片翻页
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableFingerGestureSlideShowControl"), pptSettings.IsEnableFingerGestureSlideShowControl);
|
||||
|
||||
// PPT 放映模式显示手势按钮
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchShowGestureButtonInSlideShow"), pptSettings.ShowGestureButtonInSlideShow);
|
||||
|
||||
// PPT时间显示胶囊
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnablePPTTimeCapsule"), pptSettings.EnablePPTTimeCapsule);
|
||||
|
||||
// 时间胶囊位置
|
||||
SetOptionButtonState("PPTTimeCapsulePosition", pptSettings.PPTTimeCapsulePosition);
|
||||
|
||||
// 记忆并提示上次播放位置
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchNotifyPreviousPage"), pptSettings.IsNotifyPreviousPage);
|
||||
|
||||
// 进入放映时回到首页
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAlwaysGoToFirstPageOnReenter"), pptSettings.IsAlwaysGoToFirstPageOnReenter);
|
||||
|
||||
// 提示隐藏幻灯片
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchNotifyHiddenPage"), pptSettings.IsNotifyHiddenPage);
|
||||
|
||||
// 提示是否已启用自动播放
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchNotifyAutoPlayPresentation"), pptSettings.IsNotifyAutoPlayPresentation);
|
||||
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
UpdatePPTBtnPreview();
|
||||
}), System.Windows.Threading.DispatcherPriority.Loaded);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"加载PowerPoint设置时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"加载PowerPoint设置时出�? {ex.Message}");
|
||||
}
|
||||
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找ToggleSwitch控件
|
||||
/// </summary>
|
||||
private Border FindToggleSwitch(string name)
|
||||
{
|
||||
return this.FindDescendantByName(name) as Border;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置ToggleSwitch状态
|
||||
/// </summary>
|
||||
private void SetToggleSwitchState(Border toggleSwitch, bool isOn)
|
||||
{
|
||||
if (toggleSwitch == null) return;
|
||||
toggleSwitch.Background = isOn
|
||||
? new SolidColorBrush(Color.FromRgb(53, 132, 228))
|
||||
: ThemeHelper.GetButtonBackgroundBrush();
|
||||
? ThemeHelper.GetToggleSwitchOnBackgroundBrush()
|
||||
: ThemeHelper.GetToggleSwitchOffBackgroundBrush();
|
||||
var innerBorder = toggleSwitch.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
@@ -269,9 +233,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置选项按钮状态
|
||||
/// </summary>
|
||||
private void SetOptionButtonState(string group, int selectedIndex)
|
||||
{
|
||||
var buttons = new Dictionary<string, string[]>
|
||||
@@ -288,31 +249,11 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
var button = this.FindDescendantByName($"{group}{buttonNames[i]}Border") as Border;
|
||||
if (button != null)
|
||||
{
|
||||
if (i == selectedIndex)
|
||||
{
|
||||
button.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var textBlock = button.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Bold;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
button.Background = new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = button.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
}
|
||||
ThemeHelper.SetOptionButtonSelectedState(button, i == selectedIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ToggleSwitch点击事件处理
|
||||
/// </summary>
|
||||
private void ToggleSwitch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
@@ -320,7 +261,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
bool isOn = border.Background.ToString() == "#FF3584E4";
|
||||
bool isOn = ThemeHelper.IsToggleSwitchOn(border.Background);
|
||||
bool newState = !isOn;
|
||||
SetToggleSwitchState(border, newState);
|
||||
|
||||
@@ -333,100 +274,80 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
switch (tag)
|
||||
{
|
||||
case "SupportPowerPoint":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchSupportPowerPoint", newState);
|
||||
break;
|
||||
|
||||
case "PowerPointEnhancement":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchPowerPointEnhancement", newState);
|
||||
break;
|
||||
|
||||
case "SupportWPS":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchSupportWPS", newState);
|
||||
break;
|
||||
|
||||
case "EnableWppProcessKill":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableWppProcessKill", newState);
|
||||
break;
|
||||
|
||||
case "ShowPPTButton":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchShowPPTButton", newState);
|
||||
// 更新UI状态
|
||||
if (PPTButtonSettingsPanel != null)
|
||||
{
|
||||
PPTButtonSettingsPanel.Visibility = newState ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
UpdatePPTBtnPreview();
|
||||
break;
|
||||
|
||||
case "EnablePPTButtonPageClickable":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnablePPTButtonPageClickable", newState);
|
||||
break;
|
||||
|
||||
case "EnablePPTButtonLongPressPageTurn":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnablePPTButtonLongPressPageTurn", newState);
|
||||
break;
|
||||
|
||||
case "SkipAnimationsWhenGoNext":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchSkipAnimationsWhenGoNext", newState);
|
||||
break;
|
||||
|
||||
case "ShowCanvasAtNewSlideShow":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchShowCanvasAtNewSlideShow", newState);
|
||||
break;
|
||||
|
||||
case "EnableTwoFingerGestureInPresentationMode":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableTwoFingerGestureInPresentationMode", newState);
|
||||
break;
|
||||
|
||||
case "EnableFingerGestureSlideShowControl":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableFingerGestureSlideShowControl", newState);
|
||||
break;
|
||||
|
||||
case "ShowGestureButtonInSlideShow":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchShowGestureButtonInSlideShow", newState);
|
||||
break;
|
||||
|
||||
case "EnablePPTTimeCapsule":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnablePPTTimeCapsule", newState);
|
||||
break;
|
||||
|
||||
case "NotifyPreviousPage":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchNotifyPreviousPage", newState);
|
||||
break;
|
||||
|
||||
case "AlwaysGoToFirstPageOnReenter":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAlwaysGoToFirstPageOnReenter", newState);
|
||||
break;
|
||||
|
||||
case "NotifyHiddenPage":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchNotifyHiddenPage", newState);
|
||||
break;
|
||||
|
||||
case "NotifyAutoPlayPresentation":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchNotifyAutoPlayPresentation", newState);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选项按钮点击事件处理
|
||||
/// </summary>
|
||||
private void OptionButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
@@ -443,7 +364,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
string group = parts[0];
|
||||
string value = parts[1];
|
||||
|
||||
// 清除同组其他按钮的选中状态
|
||||
var parent = border.Parent as Panel;
|
||||
if (parent != null)
|
||||
{
|
||||
@@ -454,24 +374,13 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
string childTag = childBorder.Tag?.ToString();
|
||||
if (!string.IsNullOrEmpty(childTag) && childTag.StartsWith(group + "_"))
|
||||
{
|
||||
childBorder.Background = new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = childBorder.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
ThemeHelper.SetOptionButtonSelectedState(childBorder, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 设置当前按钮为选中状态
|
||||
border.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var currentTextBlock = border.Child as TextBlock;
|
||||
if (currentTextBlock != null)
|
||||
{
|
||||
currentTextBlock.FontWeight = FontWeights.Bold;
|
||||
}
|
||||
ThemeHelper.SetOptionButtonSelectedState(border, true);
|
||||
|
||||
var pptSettings = MainWindow.Settings.PowerPointSettings;
|
||||
if (pptSettings == null) return;
|
||||
@@ -501,11 +410,13 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}, "PPTTimeCapsulePosition");
|
||||
break;
|
||||
}
|
||||
|
||||
if (group.Contains("PPT") || group.Contains("Button"))
|
||||
{
|
||||
UpdatePPTBtnPreview();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// CheckBox变化事件处理
|
||||
/// </summary>
|
||||
private void CheckBox_CheckedChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
@@ -517,14 +428,17 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
var pptSettings = MainWindow.Settings.PowerPointSettings;
|
||||
if (pptSettings == null) return;
|
||||
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeCheckBoxCheckedChanged(name, checkBox.IsChecked ?? false);
|
||||
|
||||
if (name.Contains("SPPT") || name.Contains("BPPT") || name == "CheckboxSPPTDisplayPage" ||
|
||||
name == "CheckboxSPPTHalfOpacity" || name == "CheckboxSPPTBlackBackground" ||
|
||||
name == "CheckboxBPPTDisplayPage" || name == "CheckboxBPPTHalfOpacity" || name == "CheckboxBPPTBlackBackground")
|
||||
{
|
||||
UpdatePPTBtnPreview();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Slider值变化事件处理
|
||||
/// </summary>
|
||||
private void PPTButtonPositionSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
@@ -535,7 +449,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
string name = slider.Name;
|
||||
double value = slider.Value;
|
||||
|
||||
// 更新文本显示
|
||||
switch (name)
|
||||
{
|
||||
case "PPTButtonLeftPositionValueSlider":
|
||||
@@ -543,8 +456,8 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
PPTButtonLeftPositionValueText.Text = ((int)value).ToString();
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("PPTButtonLeftPositionValueSlider", value);
|
||||
UpdatePPTBtnPreview();
|
||||
break;
|
||||
|
||||
case "PPTButtonRightPositionValueSlider":
|
||||
@@ -552,8 +465,8 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
PPTButtonRightPositionValueText.Text = ((int)value).ToString();
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("PPTButtonRightPositionValueSlider", value);
|
||||
UpdatePPTBtnPreview();
|
||||
break;
|
||||
|
||||
case "PPTButtonLBPositionValueSlider":
|
||||
@@ -561,8 +474,8 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
PPTButtonLBPositionValueText.Text = ((int)value).ToString();
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("PPTButtonLBPositionValueSlider", value);
|
||||
UpdatePPTBtnPreview();
|
||||
break;
|
||||
|
||||
case "PPTButtonRBPositionValueSlider":
|
||||
@@ -570,15 +483,12 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
PPTButtonRBPositionValueText.Text = ((int)value).ToString();
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("PPTButtonRBPositionValueSlider", value);
|
||||
UpdatePPTBtnPreview();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按钮透明度Slider值变化事件处理
|
||||
/// </summary>
|
||||
private void PPTButtonOpacitySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
@@ -589,7 +499,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
string name = slider.Name;
|
||||
double value = slider.Value;
|
||||
|
||||
// 更新文本显示
|
||||
switch (name)
|
||||
{
|
||||
case "PPTLSButtonOpacityValueSlider":
|
||||
@@ -597,8 +506,8 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
PPTLSButtonOpacityValueText.Text = value.ToString("F1");
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("PPTLSButtonOpacityValueSlider", value);
|
||||
UpdatePPTBtnPreview();
|
||||
break;
|
||||
|
||||
case "PPTRSButtonOpacityValueSlider":
|
||||
@@ -606,8 +515,8 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
PPTRSButtonOpacityValueText.Text = value.ToString("F1");
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("PPTRSButtonOpacityValueSlider", value);
|
||||
UpdatePPTBtnPreview();
|
||||
break;
|
||||
|
||||
case "PPTLBButtonOpacityValueSlider":
|
||||
@@ -615,8 +524,8 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
PPTLBButtonOpacityValueText.Text = value.ToString("F1");
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("PPTLBButtonOpacityValueSlider", value);
|
||||
UpdatePPTBtnPreview();
|
||||
break;
|
||||
|
||||
case "PPTRBButtonOpacityValueSlider":
|
||||
@@ -624,24 +533,215 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
PPTRBButtonOpacityValueText.Text = value.ToString("F1");
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("PPTRBButtonOpacityValueSlider", value);
|
||||
UpdatePPTBtnPreview();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
if (MainWindow.Settings?.PowerPointSettings != null)
|
||||
{
|
||||
SetOptionButtonState("PPTTimeCapsulePosition", MainWindow.Settings.PowerPointSettings.PPTTimeCapsulePosition);
|
||||
}
|
||||
|
||||
UpdatePPTBtnPreview();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"PowerPointPanel 应用主题时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"PowerPointPanel 应用主题时出�? {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void UpdatePPTBtnPreview()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (MainWindow.Settings?.PowerPointSettings == null) return;
|
||||
|
||||
var pptSettings = MainWindow.Settings.PowerPointSettings;
|
||||
|
||||
var bopt = pptSettings.PPTBButtonsOption.ToString();
|
||||
char[] boptc = bopt.ToCharArray();
|
||||
|
||||
if (PPTBtnPreviewLB != null)
|
||||
{
|
||||
PPTBtnPreviewLB.Opacity = pptSettings.PPTLBButtonOpacity;
|
||||
}
|
||||
if (PPTBtnPreviewRB != null)
|
||||
{
|
||||
PPTBtnPreviewRB.Opacity = pptSettings.PPTRBButtonOpacity;
|
||||
}
|
||||
|
||||
if (boptc.Length >= 3 && boptc[2] == '2')
|
||||
{
|
||||
if (PPTBtnPreviewLB != null)
|
||||
{
|
||||
PPTBtnPreviewLB.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri("pack://application:,,,/Resources/PresentationExample/bottombar-white.png"));
|
||||
}
|
||||
if (PPTBtnPreviewRB != null)
|
||||
{
|
||||
PPTBtnPreviewRB.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri("pack://application:,,,/Resources/PresentationExample/bottombar-white.png"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (PPTBtnPreviewLB != null)
|
||||
{
|
||||
PPTBtnPreviewLB.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri("pack://application:,,,/Resources/PresentationExample/bottombar-white.png"));
|
||||
}
|
||||
if (PPTBtnPreviewRB != null)
|
||||
{
|
||||
PPTBtnPreviewRB.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri("pack://application:,,,/Resources/PresentationExample/bottombar-white.png"));
|
||||
}
|
||||
}
|
||||
|
||||
var sopt = pptSettings.PPTSButtonsOption.ToString();
|
||||
char[] soptc = sopt.ToCharArray();
|
||||
|
||||
if (PPTBtnPreviewLS != null)
|
||||
{
|
||||
PPTBtnPreviewLS.Opacity = pptSettings.PPTLSButtonOpacity;
|
||||
}
|
||||
if (PPTBtnPreviewRS != null)
|
||||
{
|
||||
PPTBtnPreviewRS.Opacity = pptSettings.PPTRSButtonOpacity;
|
||||
}
|
||||
|
||||
if (soptc.Length >= 3 && soptc[2] == '2')
|
||||
{
|
||||
if (PPTBtnPreviewLS != null)
|
||||
{
|
||||
PPTBtnPreviewLS.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri("pack://application:,,,/Resources/PresentationExample/sidebar-white.png"));
|
||||
}
|
||||
if (PPTBtnPreviewRS != null)
|
||||
{
|
||||
PPTBtnPreviewRS.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri("pack://application:,,,/Resources/PresentationExample/sidebar-white.png"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (PPTBtnPreviewLS != null)
|
||||
{
|
||||
PPTBtnPreviewLS.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri("pack://application:,,,/Resources/PresentationExample/sidebar-white.png"));
|
||||
}
|
||||
if (PPTBtnPreviewRS != null)
|
||||
{
|
||||
PPTBtnPreviewRS.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri("pack://application:,,,/Resources/PresentationExample/sidebar-white.png"));
|
||||
}
|
||||
}
|
||||
|
||||
var dopt = pptSettings.PPTButtonsDisplayOption.ToString();
|
||||
char[] doptc = dopt.ToCharArray();
|
||||
|
||||
if (pptSettings.ShowPPTButton)
|
||||
{
|
||||
if (PPTBtnPreviewLB != null)
|
||||
{
|
||||
PPTBtnPreviewLB.Visibility = doptc.Length > 0 && doptc[0] == '2' ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
if (PPTBtnPreviewRB != null)
|
||||
{
|
||||
PPTBtnPreviewRB.Visibility = doptc.Length > 1 && doptc[1] == '2' ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
if (PPTBtnPreviewLS != null)
|
||||
{
|
||||
PPTBtnPreviewLS.Visibility = doptc.Length > 2 && doptc[2] == '2' ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
if (PPTBtnPreviewRS != null)
|
||||
{
|
||||
PPTBtnPreviewRS.Visibility = doptc.Length > 3 && doptc[3] == '2' ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (PPTBtnPreviewLB != null) PPTBtnPreviewLB.Visibility = Visibility.Collapsed;
|
||||
if (PPTBtnPreviewRB != null) PPTBtnPreviewRB.Visibility = Visibility.Collapsed;
|
||||
if (PPTBtnPreviewLS != null) PPTBtnPreviewLS.Visibility = Visibility.Collapsed;
|
||||
if (PPTBtnPreviewRS != null) PPTBtnPreviewRS.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
var actualScreenWidth = SystemParameters.PrimaryScreenWidth;
|
||||
var actualScreenHeight = SystemParameters.PrimaryScreenHeight;
|
||||
|
||||
const double previewWidth = 324.0;
|
||||
const double previewHeight = 182.0;
|
||||
|
||||
double scaleX = previewWidth / actualScreenWidth;
|
||||
double scaleY = previewHeight / actualScreenHeight;
|
||||
|
||||
double rsPosition = pptSettings.PPTRSButtonPosition;
|
||||
double lsPosition = pptSettings.PPTLSButtonPosition;
|
||||
double lbPosition = pptSettings.PPTLBButtonPosition;
|
||||
double rbPosition = pptSettings.PPTRBButtonPosition;
|
||||
|
||||
bool showSidePageButton = sopt.Length >= 1 && sopt[0] == '2';
|
||||
bool showBottomPageButton = bopt.Length >= 1 && bopt[0] == '2';
|
||||
|
||||
const double pageButtonWidth = 50.0;
|
||||
const double pageButtonHeight = 50.0;
|
||||
|
||||
double sideOffsetY = showSidePageButton ? pageButtonHeight * scaleY : 0;
|
||||
if (PPTBtnPreviewRSTransform != null)
|
||||
{
|
||||
PPTBtnPreviewRSTransform.Y = -(rsPosition * scaleY) - sideOffsetY;
|
||||
}
|
||||
if (PPTBtnPreviewLSTransform != null)
|
||||
{
|
||||
PPTBtnPreviewLSTransform.Y = -(lsPosition * scaleY) - sideOffsetY;
|
||||
}
|
||||
|
||||
const double bottomMarginOffset = 6.0;
|
||||
double scaledMarginOffset = bottomMarginOffset * scaleX;
|
||||
|
||||
double bottomOffsetX = showBottomPageButton ? pageButtonWidth * scaleX : 0;
|
||||
if (PPTBtnPreviewLBTransform != null)
|
||||
{
|
||||
PPTBtnPreviewLBTransform.X = scaledMarginOffset + (lbPosition * scaleX) + bottomOffsetX;
|
||||
}
|
||||
if (PPTBtnPreviewRBTransform != null)
|
||||
{
|
||||
PPTBtnPreviewRBTransform.X = -(scaledMarginOffset + (rbPosition * scaleX) + bottomOffsetX);
|
||||
}
|
||||
|
||||
var dpiScaleX = 1.0;
|
||||
var dpiScaleY = 1.0;
|
||||
try
|
||||
{
|
||||
var source = PresentationSource.FromVisual(this);
|
||||
if (source?.CompositionTarget != null)
|
||||
{
|
||||
var transform = source.CompositionTarget.TransformToDevice;
|
||||
dpiScaleX = transform.M11;
|
||||
dpiScaleY = transform.M22;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
dpiScaleX = 1.0;
|
||||
dpiScaleY = 1.0;
|
||||
}
|
||||
|
||||
const double baseToolbarHeight = 24.0;
|
||||
double actualToolbarHeight = baseToolbarHeight * dpiScaleY;
|
||||
double scaledToolbarHeight = actualToolbarHeight * scaleY;
|
||||
double scaledToolbarWidth = previewWidth;
|
||||
|
||||
var toolbar = this.FindDescendantByName("PPTBtnPreviewToolbar") as System.Windows.Controls.Image;
|
||||
if (toolbar != null)
|
||||
{
|
||||
toolbar.Height = scaledToolbarHeight;
|
||||
toolbar.Width = scaledToolbarWidth;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"更新PPT按钮预览时出�? {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="691" d:DesignWidth="910">
|
||||
<Grid x:Name="SearchPanelMainGrid" Background="#fafafa" Margin="250,0,0,0">
|
||||
<!-- 搜索框区域 -->
|
||||
<Grid Height="48" VerticalAlignment="Top" Margin="0,0,0,0">
|
||||
<Border x:Name="SearchPanelTopBarBorder" Height="48" CornerRadius="0,6,0,0" Background="#fafafa">
|
||||
<Border.Effect>
|
||||
@@ -19,7 +18,6 @@
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<!-- 搜索输入框 -->
|
||||
<Border x:Name="SearchInputBorder" Grid.Column="0" Margin="60,8,12,8" Background="White" CornerRadius="8" BorderBrush="#e6e6e6" BorderThickness="1">
|
||||
<Grid>
|
||||
<Image Width="16" Height="16" Margin="12,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
@@ -45,7 +43,6 @@
|
||||
GotFocus="SearchTextBox_GotFocus"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<!-- 关闭按钮 -->
|
||||
<Border Grid.Column="1" CornerRadius="8" Background="#33ef4444" Width="34" Height="34" Margin="0,0,8,0" HorizontalAlignment="Right" VerticalAlignment="Center" MouseLeftButtonDown="CloseSearchButton_Click" Cursor="Hand">
|
||||
<Image Width="12" Height="12">
|
||||
<Image.Source>
|
||||
@@ -62,10 +59,8 @@
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<!-- 搜索结果区域 -->
|
||||
<ScrollViewer Margin="0,48,0,0" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
|
||||
<StackPanel Margin="60,12,60,24" Name="SearchResultsPanel">
|
||||
<!-- 精准和拼音匹配结果 -->
|
||||
<StackPanel Name="ExactMatchPanel" Visibility="Collapsed">
|
||||
<TextBlock x:Name="ExactMatchTitle" Text="精准匹配" FontSize="13" FontWeight="Bold" Foreground="#2e3436" Margin="0,0,0,8"/>
|
||||
<ItemsControl Name="ExactMatchItemsControl">
|
||||
@@ -85,7 +80,6 @@
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
|
||||
<!-- 模糊匹配结果 -->
|
||||
<StackPanel Name="FuzzyMatchPanel" Visibility="Collapsed" Margin="0,16,0,0">
|
||||
<TextBlock x:Name="FuzzyMatchTitle" Text="模糊匹配" FontSize="13" FontWeight="Bold" Foreground="#2e3436" Margin="0,0,0,8"/>
|
||||
<ItemsControl Name="FuzzyMatchItemsControl">
|
||||
@@ -105,7 +99,6 @@
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
|
||||
<!-- 相关项结果 -->
|
||||
<StackPanel Name="RelatedItemsPanel" Visibility="Collapsed" Margin="0,16,0,0">
|
||||
<TextBlock x:Name="RelatedItemsTitle" Text="相关项" FontSize="13" FontWeight="Bold" Foreground="#2e3436" Margin="0,0,0,8"/>
|
||||
<ItemsControl Name="RelatedItemsControl">
|
||||
@@ -125,7 +118,6 @@
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
|
||||
<!-- 无结果提示 -->
|
||||
<TextBlock Name="NoResultsText"
|
||||
Text="未找到相关设置项"
|
||||
FontSize="14"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
@@ -13,9 +13,6 @@ using Microsoft.International.Converters.PinYinConverter;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
/// <summary>
|
||||
/// SearchPanel.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class SearchPanel : UserControl
|
||||
{
|
||||
public event EventHandler<string> NavigateToItem;
|
||||
@@ -38,49 +35,21 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
|
||||
private void InitializeSettings()
|
||||
{
|
||||
// 初始化所有设置项数据
|
||||
_allSettings = new List<SettingItem>
|
||||
{
|
||||
// 启动时行为
|
||||
new SettingItem { Title = "启动时行为", Category = "启动时行为", ItemName = "StartupItem", Type = SettingItemType.Category },
|
||||
|
||||
// 画板和墨迹
|
||||
new SettingItem { Title = "画板和墨迹", Category = "画板和墨迹", ItemName = "CanvasAndInkItem", Type = SettingItemType.Category },
|
||||
|
||||
// 手势操作
|
||||
new SettingItem { Title = "手势操作", Category = "手势操作", ItemName = "GesturesItem", Type = SettingItemType.Category },
|
||||
|
||||
// 墨迹纠正
|
||||
new SettingItem { Title = "墨迹纠正", Category = "墨迹纠正", ItemName = "InkRecognitionItem", Type = SettingItemType.Category },
|
||||
|
||||
// 个性化设置
|
||||
new SettingItem { Title = "个性化设置", Category = "个性化设置", ItemName = "ThemeItem", Type = SettingItemType.Category },
|
||||
|
||||
// 快捷键设置
|
||||
new SettingItem { Title = "快捷键设置", Category = "快捷键设置", ItemName = "ShortcutsItem", Type = SettingItemType.Category },
|
||||
|
||||
// 崩溃处理
|
||||
new SettingItem { Title = "崩溃处理", Category = "崩溃处理", ItemName = "CrashActionItem", Type = SettingItemType.Category },
|
||||
|
||||
// PowerPoint 支持
|
||||
new SettingItem { Title = "PowerPoint 支持", Category = "PowerPoint 支持", ItemName = "PowerPointItem", Type = SettingItemType.Category },
|
||||
|
||||
// 自动化行为
|
||||
new SettingItem { Title = "自动化行为", Category = "自动化行为", ItemName = "AutomationItem", Type = SettingItemType.Category },
|
||||
|
||||
// 随机点名
|
||||
new SettingItem { Title = "随机点名", Category = "随机点名", ItemName = "LuckyRandomItem", Type = SettingItemType.Category },
|
||||
|
||||
// 存储空间
|
||||
new SettingItem { Title = "存储空间", Category = "存储空间", ItemName = "StorageItem", Type = SettingItemType.Category },
|
||||
|
||||
// 截图和屏幕捕捉
|
||||
new SettingItem { Title = "截图和屏幕捕捉", Category = "截图和屏幕捕捉", ItemName = "SnapshotItem", Type = SettingItemType.Category },
|
||||
|
||||
// 高级选项
|
||||
new SettingItem { Title = "截图和屏幕捕获", Category = "截图和屏幕捕获", ItemName = "SnapshotItem", Type = SettingItemType.Category },
|
||||
new SettingItem { Title = "高级选项", Category = "高级选项", ItemName = "AdvancedItem", Type = SettingItemType.Category },
|
||||
|
||||
// 关于
|
||||
new SettingItem { Title = "关于 InkCanvasForClass", Category = "关于", ItemName = "AboutItem", Type = SettingItemType.Category },
|
||||
};
|
||||
}
|
||||
@@ -100,14 +69,10 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
var searchLower = searchText.ToLower();
|
||||
var exactMatchSet = new HashSet<string>();
|
||||
var fuzzyMatchSet = new HashSet<string>();
|
||||
|
||||
// 精准匹配和拼音匹配
|
||||
foreach (var setting in _allSettings)
|
||||
{
|
||||
var titleLower = setting.Title.ToLower();
|
||||
var categoryLower = setting.Category.ToLower();
|
||||
|
||||
// 精准匹配
|
||||
if (titleLower.Contains(searchLower) || categoryLower.Contains(searchLower))
|
||||
{
|
||||
if (!exactMatchSet.Contains(setting.ItemName))
|
||||
@@ -123,7 +88,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
exactMatchSet.Add(setting.ItemName);
|
||||
}
|
||||
}
|
||||
// 拼音匹配
|
||||
else if (ContainsPinyinMatch(setting.Title, searchText) || ContainsPinyinMatch(setting.Category, searchText))
|
||||
{
|
||||
if (!exactMatchSet.Contains(setting.ItemName))
|
||||
@@ -140,8 +104,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 模糊匹配
|
||||
foreach (var setting in _allSettings)
|
||||
{
|
||||
if (exactMatchSet.Contains(setting.ItemName))
|
||||
@@ -164,14 +126,11 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 相关项
|
||||
var allMatched = new HashSet<string>(exactMatchSet.Concat(fuzzyMatchSet));
|
||||
foreach (var setting in _allSettings)
|
||||
{
|
||||
if (!allMatched.Contains(setting.ItemName))
|
||||
{
|
||||
// 简单的相关性判断
|
||||
if (IsRelated(setting, searchText))
|
||||
{
|
||||
_relatedItems.Add(new SearchResultItem
|
||||
@@ -196,14 +155,9 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
|
||||
try
|
||||
{
|
||||
// 将搜索词转换为小写
|
||||
var searchLower = search.ToLower();
|
||||
|
||||
// 获取文本的拼音首字母和全拼
|
||||
var pinyinInitials = GetPinyinInitials(text);
|
||||
var pinyinFull = GetPinyinFull(text);
|
||||
|
||||
// 检查搜索词是否匹配拼音首字母或全拼
|
||||
if (pinyinInitials.ToLower().Contains(searchLower) ||
|
||||
pinyinFull.ToLower().Contains(searchLower))
|
||||
{
|
||||
@@ -212,7 +166,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
catch
|
||||
{
|
||||
// 如果拼音转换失败,返回false
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -234,7 +187,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
var pinyin = chineseChar.Pinyins[0];
|
||||
if (!string.IsNullOrEmpty(pinyin) && pinyin.Length > 0)
|
||||
{
|
||||
// 获取首字母(移除音调数字后取第一个字母)
|
||||
var firstChar = Regex.Replace(pinyin, @"\d", "")[0];
|
||||
sb.Append(firstChar);
|
||||
}
|
||||
@@ -266,7 +218,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
if (chineseChar.PinyinCount > 0)
|
||||
{
|
||||
var pinyin = chineseChar.Pinyins[0];
|
||||
// 移除音调数字
|
||||
pinyin = Regex.Replace(pinyin, @"\d", "");
|
||||
sb.Append(pinyin);
|
||||
}
|
||||
@@ -293,8 +244,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(text) || string.IsNullOrWhiteSpace(search))
|
||||
return false;
|
||||
|
||||
// 简单的模糊匹配:检查搜索词的字符是否按顺序出现在文本中
|
||||
int searchIndex = 0;
|
||||
foreach (char c in text)
|
||||
{
|
||||
@@ -310,9 +259,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
|
||||
private bool IsRelated(SettingItem setting, string search)
|
||||
{
|
||||
// 简单的相关性判断,可以根据需要改进
|
||||
// 例如:检查是否有共同的关键词等
|
||||
return false; // 暂时禁用相关项功能
|
||||
return false;
|
||||
}
|
||||
|
||||
private void UpdateResultsVisibility()
|
||||
@@ -380,42 +327,28 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
SearchTextBox.Text = text;
|
||||
PerformSearch(text);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
bool isDarkTheme = ThemeHelper.IsDarkTheme;
|
||||
|
||||
// 更新主背景
|
||||
if (SearchPanelMainGrid != null)
|
||||
{
|
||||
SearchPanelMainGrid.Background = ThemeHelper.GetBackgroundPrimaryBrush();
|
||||
}
|
||||
|
||||
// 更新顶部栏背景
|
||||
if (SearchPanelTopBarBorder != null)
|
||||
{
|
||||
SearchPanelTopBarBorder.Background = ThemeHelper.GetBackgroundPrimaryBrush();
|
||||
}
|
||||
|
||||
// 更新搜索输入框
|
||||
if (SearchInputBorder != null)
|
||||
{
|
||||
SearchInputBorder.Background = ThemeHelper.GetTextBoxBackgroundBrush();
|
||||
SearchInputBorder.BorderBrush = ThemeHelper.GetTextBoxBorderBrush();
|
||||
}
|
||||
|
||||
// 更新搜索框文字颜色
|
||||
if (SearchTextBox != null)
|
||||
{
|
||||
SearchTextBox.Foreground = ThemeHelper.GetTextPrimaryBrush();
|
||||
}
|
||||
|
||||
// 更新标题文字颜色
|
||||
if (ExactMatchTitle != null)
|
||||
{
|
||||
ExactMatchTitle.Foreground = ThemeHelper.GetTextPrimaryBrush();
|
||||
@@ -428,37 +361,25 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
RelatedItemsTitle.Foreground = ThemeHelper.GetTextPrimaryBrush();
|
||||
}
|
||||
|
||||
// 更新无结果提示文字颜色
|
||||
if (NoResultsText != null)
|
||||
{
|
||||
NoResultsText.Foreground = ThemeHelper.GetTextSecondaryBrush();
|
||||
}
|
||||
|
||||
// 更新搜索框中的图标颜色
|
||||
UpdateSearchIconColor(isDarkTheme);
|
||||
|
||||
// 使用 ThemeHelper 递归更新其他元素(如搜索结果项)
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"SearchPanel 应用主题时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"SearchPanel 应用主题时出�? {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新搜索框中的图标颜色
|
||||
/// </summary>
|
||||
private void UpdateSearchIconColor(bool isDarkTheme)
|
||||
{
|
||||
try
|
||||
{
|
||||
Color iconColor = isDarkTheme
|
||||
? Color.FromRgb(243, 243, 243) // 深色主题使用浅色图标 #F3F3F3
|
||||
: Color.FromRgb(34, 34, 34); // 浅色主题使用深色图标 #222222
|
||||
|
||||
// 查找搜索输入框中的图标
|
||||
? Color.FromRgb(243, 243, 243)
|
||||
: Color.FromRgb(34, 34, 34);
|
||||
if (SearchInputBorder != null)
|
||||
{
|
||||
var image = FindVisualChild<Image>(SearchInputBorder);
|
||||
@@ -474,13 +395,9 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"更新搜索图标颜色时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"更新搜索图标颜色时出�? {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 克隆 DrawingGroup 并更新颜色
|
||||
/// </summary>
|
||||
private DrawingGroup CloneDrawingGroup(DrawingGroup source, Color newColor)
|
||||
{
|
||||
var cloned = new DrawingGroup();
|
||||
@@ -512,21 +429,17 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
|
||||
return cloned;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 克隆 Brush 并更新颜色
|
||||
/// </summary>
|
||||
private Brush CloneBrush(Brush source, Color newColor)
|
||||
{
|
||||
if (source is SolidColorBrush solidBrush)
|
||||
{
|
||||
var originalColor = solidBrush.Color;
|
||||
if (originalColor.R == 34 && originalColor.G == 34 && originalColor.B == 34) // #222222
|
||||
if (originalColor.R == 34 && originalColor.G == 34 && originalColor.B == 34)
|
||||
{
|
||||
return new SolidColorBrush(newColor) { Opacity = solidBrush.Opacity };
|
||||
}
|
||||
else if (originalColor.A > 0 && originalColor != Colors.Transparent &&
|
||||
originalColor.R < 50 && originalColor.G < 50 && originalColor.B < 50) // 深色
|
||||
originalColor.R < 50 && originalColor.G < 50 && originalColor.B < 50)
|
||||
{
|
||||
return new SolidColorBrush(newColor) { Opacity = solidBrush.Opacity };
|
||||
}
|
||||
@@ -534,10 +447,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
return source?.Clone();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 克隆 Pen 并更新颜色
|
||||
/// </summary>
|
||||
private Pen ClonePen(Pen source, Color newColor)
|
||||
{
|
||||
var clonedBrush = CloneBrush(source.Brush, newColor);
|
||||
@@ -549,10 +458,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
MiterLimit = source.MiterLimit
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 在视觉树中查找指定类型的子元素
|
||||
/// </summary>
|
||||
private T FindVisualChild<T>(DependencyObject parent) where T : DependencyObject
|
||||
{
|
||||
for (int i = 0; i < System.Windows.Media.VisualTreeHelper.GetChildrenCount(parent); i++)
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
|
||||
public enum SettingsItemType
|
||||
{
|
||||
Plain, // 只显示Title和Description
|
||||
Plain,
|
||||
SingleToggleSwtich,
|
||||
ToggleSwitchWithArrowButton,
|
||||
SelectionButtons,
|
||||
@@ -48,8 +48,8 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
if (_toggleSwitchToggled != value)
|
||||
{
|
||||
_toggleSwitchToggled = value;
|
||||
OnPropertyChanged(nameof(ToggleSwitchToggled)); // 通知绑定控件属性变化
|
||||
OnToggleSwitchToggled?.Invoke(this, EventArgs.Empty); // 触发事件
|
||||
OnPropertyChanged(nameof(ToggleSwitchToggled));
|
||||
OnToggleSwitchToggled?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -60,7 +60,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
private SolidColorBrush _toggleSwitchBackground = new SolidColorBrush(Color.FromRgb(53, 132, 228));
|
||||
private SolidColorBrush _toggleSwitchBackground = ThemeHelper.GetToggleSwitchOnBackgroundBrush();
|
||||
public SolidColorBrush ToggleSwitchBackground
|
||||
{
|
||||
get => _toggleSwitchBackground;
|
||||
@@ -69,7 +69,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
if (_toggleSwitchBackground != value)
|
||||
{
|
||||
_toggleSwitchBackground = value;
|
||||
OnPropertyChanged(nameof(ToggleSwitchBackground)); // 通知绑定控件属性变化
|
||||
OnPropertyChanged(nameof(ToggleSwitchBackground));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -83,7 +83,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
if (_toggleSwitchEnabled != value)
|
||||
{
|
||||
_toggleSwitchEnabled = value;
|
||||
OnPropertyChanged(nameof(ToggleSwitchEnabled)); // 通知绑定控件属性变化
|
||||
OnPropertyChanged(nameof(ToggleSwitchEnabled));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Ink_Canvas;
|
||||
using Ink_Canvas;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using System;
|
||||
using System.Windows;
|
||||
@@ -8,9 +8,6 @@ using System.Windows.Media;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
/// <summary>
|
||||
/// 设置面板基类,提供通用的辅助方法
|
||||
/// </summary>
|
||||
public abstract class SettingsPanelBase : UserControl
|
||||
{
|
||||
protected bool _isLoaded = false;
|
||||
@@ -23,9 +20,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
private void SettingsPanelBase_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LoadSettings();
|
||||
// 添加触摸支持
|
||||
EnableTouchSupport();
|
||||
// 应用主题(如果面板有 ApplyTheme 方法)
|
||||
try
|
||||
{
|
||||
var applyThemeMethod = this.GetType().GetMethod("ApplyTheme",
|
||||
@@ -37,19 +32,15 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"SettingsPanelBase 应用主题时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"SettingsPanelBase 应用主题时出�? {ex.Message}");
|
||||
}
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为面板中的所有交互控件启用触摸支持
|
||||
/// </summary>
|
||||
protected virtual void EnableTouchSupport()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 延迟执行,确保所有控件都已加载
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
EnableTouchSupportForControls(this);
|
||||
@@ -57,13 +48,10 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"启用触摸支持时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"启用触摸支持时出�? {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为控件树中的所有交互控件启用触摸支持
|
||||
/// </summary>
|
||||
private void EnableTouchSupportForControls(DependencyObject parent)
|
||||
{
|
||||
if (parent == null) return;
|
||||
@@ -72,117 +60,87 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
var child = VisualTreeHelper.GetChild(parent, i);
|
||||
|
||||
// 为 Border 控件(ToggleSwitch、选项按钮等)启用触摸支持
|
||||
if (child is Border border)
|
||||
{
|
||||
// 检查是否是交互控件(有 Tag 或 Cursor 为 Hand)
|
||||
if (border.Tag != null || border.Cursor == Cursors.Hand)
|
||||
{
|
||||
border.IsManipulationEnabled = true;
|
||||
|
||||
// 添加触摸事件支持,将触摸事件转换为鼠标事件
|
||||
border.TouchDown += Border_TouchDown;
|
||||
border.PreviewTouchDown += Border_PreviewTouchDown;
|
||||
}
|
||||
}
|
||||
// 为 Button 控件启用触摸支持
|
||||
else if (child is Button button)
|
||||
{
|
||||
button.IsManipulationEnabled = true;
|
||||
}
|
||||
// 为 ComboBox 启用触摸支持
|
||||
else if (child is ComboBox comboBox)
|
||||
{
|
||||
comboBox.IsManipulationEnabled = true;
|
||||
}
|
||||
// 为 Slider 启用触摸支持
|
||||
else if (child is Slider slider)
|
||||
{
|
||||
slider.IsManipulationEnabled = true;
|
||||
}
|
||||
// 为 TextBox 启用触摸支持
|
||||
else if (child is TextBox textBox)
|
||||
{
|
||||
textBox.IsManipulationEnabled = true;
|
||||
}
|
||||
|
||||
// 递归处理子元素
|
||||
EnableTouchSupportForControls(child);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Border 触摸按下事件处理
|
||||
/// </summary>
|
||||
private void Border_TouchDown(object sender, TouchEventArgs e)
|
||||
{
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
// 获取触摸点位置
|
||||
var touchPoint = e.GetTouchPoint(border);
|
||||
|
||||
// 创建模拟的鼠标事件
|
||||
var mouseButtonEventArgs = new MouseButtonEventArgs(Mouse.PrimaryDevice, Environment.TickCount, MouseButton.Left)
|
||||
{
|
||||
RoutedEvent = UIElement.MouseLeftButtonDownEvent,
|
||||
Source = border
|
||||
};
|
||||
|
||||
// 触发鼠标按下事件
|
||||
border.RaiseEvent(mouseButtonEventArgs);
|
||||
|
||||
// 捕获触摸设备
|
||||
border.CaptureTouch(e.TouchDevice);
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Border 预览触摸按下事件处理
|
||||
/// </summary>
|
||||
private void Border_PreviewTouchDown(object sender, TouchEventArgs e)
|
||||
{
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
// 获取触摸点位置
|
||||
var touchPoint = e.GetTouchPoint(border);
|
||||
|
||||
// 创建模拟的鼠标事件
|
||||
var mouseButtonEventArgs = new MouseButtonEventArgs(Mouse.PrimaryDevice, Environment.TickCount, MouseButton.Left)
|
||||
{
|
||||
RoutedEvent = UIElement.PreviewMouseLeftButtonDownEvent,
|
||||
Source = border
|
||||
};
|
||||
|
||||
// 触发预览鼠标按下事件
|
||||
border.RaiseEvent(mouseButtonEventArgs);
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载设置到UI - 子类需要实现
|
||||
/// </summary>
|
||||
public abstract void LoadSettings();
|
||||
|
||||
/// <summary>
|
||||
/// 查找ToggleSwitch控件
|
||||
/// </summary>
|
||||
protected Border FindToggleSwitch(string name)
|
||||
{
|
||||
return this.FindDescendantByName(name) as Border;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置ToggleSwitch状态
|
||||
/// </summary>
|
||||
protected void SetToggleSwitchState(Border toggleSwitch, bool isOn)
|
||||
{
|
||||
if (toggleSwitch == null) return;
|
||||
toggleSwitch.Background = isOn
|
||||
? new SolidColorBrush(Color.FromRgb(53, 132, 228))
|
||||
: ThemeHelper.GetButtonBackgroundBrush();
|
||||
? ThemeHelper.GetToggleSwitchOnBackgroundBrush()
|
||||
: ThemeHelper.GetToggleSwitchOffBackgroundBrush();
|
||||
var innerBorder = toggleSwitch.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
@@ -190,9 +148,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通用的ToggleSwitch点击事件处理
|
||||
/// </summary>
|
||||
protected virtual void ToggleSwitch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
@@ -200,7 +155,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
bool isOn = border.Background.ToString() == "#FF3584E4";
|
||||
bool isOn = ThemeHelper.IsToggleSwitchOn(border.Background);
|
||||
bool newState = !isOn;
|
||||
SetToggleSwitchState(border, newState);
|
||||
|
||||
@@ -210,17 +165,10 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
HandleToggleSwitchChange(tag, newState);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理ToggleSwitch变化 - 子类需要实现
|
||||
/// </summary>
|
||||
protected abstract void HandleToggleSwitchChange(string tag, bool newState);
|
||||
|
||||
/// <summary>
|
||||
/// 处理选项按钮变化 - 子类可以重写
|
||||
/// </summary>
|
||||
protected virtual void HandleOptionButtonChange(object sender, string tag)
|
||||
{
|
||||
// 默认实现:清除同组其他按钮的选中状态
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
@@ -230,7 +178,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
string group = parts[0];
|
||||
string value = parts[1];
|
||||
|
||||
// 清除同组其他按钮的选中状态
|
||||
var parent = border.Parent as Panel;
|
||||
if (parent != null)
|
||||
{
|
||||
@@ -252,8 +199,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
// 设置当前按钮为选中状态
|
||||
border.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
border.Background = ThemeHelper.GetOptionButtonSelectedBackgroundBrush();
|
||||
var currentTextBlock = border.Child as TextBlock;
|
||||
if (currentTextBlock != null)
|
||||
{
|
||||
@@ -264,9 +210,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理选项变化 - 子类需要实现
|
||||
/// </summary>
|
||||
protected abstract void HandleOptionChange(string group, string value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
d:DesignHeight="950" d:DesignWidth="640">
|
||||
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="ScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
|
||||
<StackPanel Margin="60,12,60,24">
|
||||
<!-- 设置项已清空,仅保留页面框架 -->
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
/// <summary>
|
||||
/// ShortcutsPanel.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ShortcutsPanel : UserControl
|
||||
{
|
||||
public ShortcutsPanel()
|
||||
@@ -29,10 +26,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
@@ -41,7 +34,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"ShortcutsPanel 应用主题时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"ShortcutsPanel 应用主题时出�? {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="ComboBoxStyles.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<!-- 开关样式模板 -->
|
||||
<Style x:Key="ToggleSwitchStyle" TargetType="Border">
|
||||
<Setter Property="Width" Value="48"/>
|
||||
<Setter Property="Height" Value="25"/>
|
||||
@@ -27,7 +26,6 @@
|
||||
</UserControl.Resources>
|
||||
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="ScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
|
||||
<StackPanel Margin="60,12,60,24">
|
||||
<!-- 截图设置 -->
|
||||
<Border BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="截图设置" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
@@ -37,7 +35,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="清空画布时自动保存当前画布截图" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoSaveStrokesAtClear" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="AutoSaveStrokesAtClear" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -51,7 +49,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="截图按日期分类保存到不同文件夹" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchSaveScreenshotsInDateFolders" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="SaveScreenshotsInDateFolders" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -65,7 +63,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="截图时同时保存当前画布的墨迹数据" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoSaveStrokesAtScreenshot" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="AutoSaveStrokesAtScreenshot" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -79,7 +77,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后,在幻灯片有墨迹时翻页会自动截屏" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoSaveScreenShotInPowerPoint" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="AutoSaveScreenShotInPowerPoint" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -100,7 +98,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 截图保存路径设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="截图保存路径" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
@@ -108,40 +105,26 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="墨迹与截图的保存路径" HorizontalAlignment="Left" Margin="0,0,0,8"/>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,8">
|
||||
<TextBox x:Name="AutoSavedStrokesLocation" Width="320" Text="D:\Ink Canvas" TextWrapping="Wrap" TextChanged="AutoSavedStrokesLocation_TextChanged"/>
|
||||
<Button x:Name="AutoSavedStrokesLocationButton" Content="浏览" Padding="12,6" Margin="8,0,0,0" Background="#2563eb" Foreground="White" Click="AutoSavedStrokesLocationButton_Click"/>
|
||||
<Button x:Name="AutoSavedStrokesLocationButton" Content="浏览" Padding="12,6" Margin="8,0,0,0" Click="AutoSavedStrokesLocationButton_Click"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,8">
|
||||
<Button x:Name="SetAutoSavedStrokesLocationToDiskDButton" Content="设置保存到 D:\Ink Canvas" Padding="12,6" Margin="0,0,8,0" Background="#2563eb" Foreground="White" Click="SetAutoSavedStrokesLocationToDiskDButton_Click"/>
|
||||
<Button x:Name="SetAutoSavedStrokesLocationToDocumentFolderButton" Content="设置保存到 文档" Padding="12,6" Background="#2563eb" Foreground="White" Click="SetAutoSavedStrokesLocationToDocumentFolderButton_Click"/>
|
||||
<Button x:Name="SetAutoSavedStrokesLocationToDiskDButton" Content="设置保存到 D:\Ink Canvas" Padding="12,6" Margin="0,0,8,0" Click="SetAutoSavedStrokesLocationToDiskDButton_Click"/>
|
||||
<Button x:Name="SetAutoSavedStrokesLocationToDocumentFolderButton" Content="设置保存到 文档" Padding="12,6" Click="SetAutoSavedStrokesLocationToDocumentFolderButton_Click"/>
|
||||
</StackPanel>
|
||||
<TextBlock Text="请注意检查保存文件夹是否有写入权限" TextWrapping="Wrap" Foreground="#9a9996" FontSize="11"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 墨迹设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="墨迹保存设置" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="绘制圆时显示圆心位置" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="绘制圆形时显示圆心标记" HorizontalAlignment="Left"/>
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="定时自动保存墨迹" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="开启后将在设定时间间隔自动保存墨迹,仅在画布可见且有墨迹时才会保存" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchShowCircleCenter" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="ShowCircleCenter" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="使用WPF默认贝塞尔曲线平滑" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="使用WPF内置的曲线平滑算法" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchFitToCurve" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="FitToCurve" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border x:Name="ToggleSwitchEnableAutoSaveStrokes" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="EnableAutoSaveStrokes" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -149,27 +132,45 @@
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="使用高级曲线平滑(推荐)" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="使用改进的贝塞尔曲线平滑算法,提供更好的绘制效果" HorizontalAlignment="Left"/>
|
||||
<StackPanel x:Name="AutoSaveIntervalPanel" Visibility="Collapsed">
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<StackPanel Orientation="Vertical" Margin="0,0,15,0">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="保存间隔" HorizontalAlignment="Left" Margin="0,0,0,8"/>
|
||||
<WrapPanel Orientation="Horizontal">
|
||||
<Border x:Name="AutoSaveStrokesInterval1MinBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="AutoSaveStrokesInterval_1" Margin="0,0,8,8" MouseLeftButtonDown="AutoSaveIntervalButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="1分钟"/>
|
||||
</Border>
|
||||
<Border x:Name="AutoSaveStrokesInterval3MinBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="AutoSaveStrokesInterval_3" Margin="0,0,8,8" MouseLeftButtonDown="AutoSaveIntervalButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="3分钟"/>
|
||||
</Border>
|
||||
<Border x:Name="AutoSaveStrokesInterval5MinBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="AutoSaveStrokesInterval_5" Margin="0,0,8,8" MouseLeftButtonDown="AutoSaveIntervalButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="5分钟"/>
|
||||
</Border>
|
||||
<Border x:Name="AutoSaveStrokesInterval10MinBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="AutoSaveStrokesInterval_10" Margin="0,0,8,8" MouseLeftButtonDown="AutoSaveIntervalButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="10分钟"/>
|
||||
</Border>
|
||||
<Border x:Name="AutoSaveStrokesInterval15MinBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="AutoSaveStrokesInterval_15" Margin="0,0,8,8" MouseLeftButtonDown="AutoSaveIntervalButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="15分钟"/>
|
||||
</Border>
|
||||
<Border x:Name="AutoSaveStrokesInterval30MinBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="AutoSaveStrokesInterval_30" Margin="0,0,8,8" MouseLeftButtonDown="AutoSaveIntervalButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="30分钟"/>
|
||||
</Border>
|
||||
<Border x:Name="AutoSaveStrokesInterval60MinBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="AutoSaveStrokesInterval_60" Margin="0,0,8,8" MouseLeftButtonDown="AutoSaveIntervalButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="60分钟"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAdvancedBezierSmoothing" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="AdvancedBezierSmoothing" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启用墨迹渐隐功能" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后墨迹不会绘制到画布上,而是保持湿墨迹状态,根据设置的渐隐时间自动消失" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Grid MinHeight="54">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Vertical" Grid.Column="0" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0,8,0,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="墨迹全页面保存" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="开启后自动保存和手动保存墨迹时将以全屏模式保存。如果存在多个画布和墨迹,将把所有页面的墨迹按照每页为单位保存进一个压缩包中" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableInkFade" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="EnableInkFade" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border x:Name="ToggleSwitchSaveFullPageStrokes" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Grid.Column="1" VerticalAlignment="Top" Margin="0,8,15,8" Tag="SaveFullPageStrokes" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -177,21 +178,41 @@
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54" x:Name="InkFadeTimePanel" Visibility="Collapsed">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="墨迹渐隐时间" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="设置墨迹从绘制到完全消失的时间" HorizontalAlignment="Left"/>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="保存为XML格式" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="开启后保存墨迹时将使用XML格式(ISF格式),便于查看和编辑墨迹数据" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="InkFadeTimeSlider" Width="150" Minimum="1000" Maximum="10000" Value="3000" TickFrequency="1000" IsSnapToTickEnabled="True" ValueChanged="InkFadeTimeSlider_ValueChanged"/>
|
||||
<TextBlock x:Name="InkFadeTimeText" Text="3000ms" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchSaveStrokesAsXML" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="SaveStrokesAsXML" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid MinHeight="54">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Vertical" Grid.Column="0" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0,8,0,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="自动保存幻灯片墨迹" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="开启后将在结束幻灯片放映时自动保存已有墨迹,并在下次打开时自动加载(文件名和幻灯片页数都要相同)" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoSaveStrokesInPowerPoint" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Grid.Column="1" VerticalAlignment="Top" Margin="0,8,15,8" Tag="AutoSaveStrokesInPowerPoint" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 自动清理设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="自动清理设置" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
@@ -201,7 +222,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后将会删除自动保存目录下所有后缀名为 .icstk 和 .png 的文件" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoDelSavedFiles" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="AutoDelSavedFiles" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Ink_Canvas;
|
||||
using Ink_Canvas;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using System;
|
||||
using System.IO;
|
||||
@@ -9,9 +9,6 @@ using Application = System.Windows.Application;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
/// <summary>
|
||||
/// SnapshotPanel.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class SnapshotPanel : System.Windows.Controls.UserControl
|
||||
{
|
||||
private bool _isLoaded = false;
|
||||
@@ -25,21 +22,15 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
private void SnapshotPanel_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LoadSettings();
|
||||
// 添加触摸支持
|
||||
EnableTouchSupport();
|
||||
// 应用主题
|
||||
ApplyTheme();
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为面板中的所有交互控件启用触摸支持
|
||||
/// </summary>
|
||||
private void EnableTouchSupport()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 延迟执行,确保所有控件都已加载
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
MainWindowSettingsHelper.EnableTouchSupportForControls(this);
|
||||
@@ -47,7 +38,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"SnapshotPanel 启用触摸支持时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"SnapshotPanel 启用触摸支持时出�? {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,9 +58,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载设置到UI
|
||||
/// </summary>
|
||||
public void LoadSettings()
|
||||
{
|
||||
if (MainWindow.Settings == null) return;
|
||||
@@ -78,7 +66,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
|
||||
try
|
||||
{
|
||||
// 清屏时自动截图
|
||||
if (MainWindow.Settings.Automation != null)
|
||||
{
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAutoSaveStrokesAtClear"), MainWindow.Settings.Automation.IsAutoSaveStrokesAtClear);
|
||||
@@ -86,7 +73,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAutoSaveStrokesAtScreenshot"), MainWindow.Settings.Automation.IsAutoSaveStrokesAtScreenshot);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAutoDelSavedFiles"), MainWindow.Settings.Automation.AutoDelSavedFiles);
|
||||
|
||||
// 自动截图最小墨迹量
|
||||
if (SideControlMinimumAutomationSlider != null)
|
||||
{
|
||||
double minValue = MainWindow.Settings.Automation.MinimumAutomationStrokeNumber;
|
||||
@@ -98,17 +84,15 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
// 保存路径
|
||||
if (AutoSavedStrokesLocation != null)
|
||||
{
|
||||
AutoSavedStrokesLocation.Text = MainWindow.Settings.Automation.AutoSavedStrokesLocation;
|
||||
}
|
||||
|
||||
// 自动删除保存时长
|
||||
if (ComboBoxAutoDelSavedFilesDaysThreshold != null)
|
||||
{
|
||||
int days = MainWindow.Settings.Automation.AutoDelSavedFilesDaysThreshold;
|
||||
int selectedIndex = 4; // 默认15天
|
||||
int selectedIndex = 4;
|
||||
switch (days)
|
||||
{
|
||||
case 1: selectedIndex = 0; break;
|
||||
@@ -130,67 +114,49 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
// 自动幻灯片截屏
|
||||
if (MainWindow.Settings.PowerPointSettings != null)
|
||||
{
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAutoSaveScreenShotInPowerPoint"), MainWindow.Settings.PowerPointSettings.IsAutoSaveScreenShotInPowerPoint);
|
||||
}
|
||||
|
||||
// 墨迹设置
|
||||
if (MainWindow.Settings.Canvas != null)
|
||||
if (MainWindow.Settings.Automation != null)
|
||||
{
|
||||
var canvas = MainWindow.Settings.Canvas;
|
||||
|
||||
// 绘制圆时显示圆心位置
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchShowCircleCenter"), canvas.ShowCircleCenter);
|
||||
|
||||
// 使用WPF默认贝塞尔曲线平滑
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchFitToCurve"), canvas.FitToCurve && !canvas.UseAdvancedBezierSmoothing);
|
||||
|
||||
// 使用高级贝塞尔曲线平滑
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAdvancedBezierSmoothing"), canvas.UseAdvancedBezierSmoothing);
|
||||
|
||||
// 启用墨迹渐隐功能
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableInkFade"), canvas.EnableInkFade);
|
||||
if (InkFadeTimePanel != null)
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableAutoSaveStrokes"), MainWindow.Settings.Automation.IsEnableAutoSaveStrokes);
|
||||
if (AutoSaveIntervalPanel != null)
|
||||
{
|
||||
InkFadeTimePanel.Visibility = canvas.EnableInkFade ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
if (InkFadeTimeSlider != null)
|
||||
{
|
||||
InkFadeTimeSlider.Value = canvas.InkFadeTime;
|
||||
if (InkFadeTimeText != null)
|
||||
{
|
||||
InkFadeTimeText.Text = $"{canvas.InkFadeTime}ms";
|
||||
}
|
||||
AutoSaveIntervalPanel.Visibility = MainWindow.Settings.Automation.IsEnableAutoSaveStrokes ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
LoadAutoSaveIntervalSettings();
|
||||
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchSaveFullPageStrokes"), MainWindow.Settings.Automation.IsSaveFullPageStrokes);
|
||||
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchSaveStrokesAsXML"), MainWindow.Settings.Automation.IsSaveStrokesAsXML);
|
||||
}
|
||||
|
||||
if (MainWindow.Settings.PowerPointSettings != null)
|
||||
{
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAutoSaveStrokesInPowerPoint"), MainWindow.Settings.PowerPointSettings.IsAutoSaveStrokesInPowerPoint);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"加载截图设置时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"加载截图设置时出�? {ex.Message}");
|
||||
}
|
||||
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找ToggleSwitch控件
|
||||
/// </summary>
|
||||
private Border FindToggleSwitch(string name)
|
||||
{
|
||||
return this.FindDescendantByName(name) as Border;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置ToggleSwitch状态
|
||||
/// </summary>
|
||||
private void SetToggleSwitchState(Border toggleSwitch, bool isOn)
|
||||
{
|
||||
if (toggleSwitch == null) return;
|
||||
toggleSwitch.Background = isOn
|
||||
? new SolidColorBrush(Color.FromRgb(53, 132, 228))
|
||||
: ThemeHelper.GetButtonBackgroundBrush();
|
||||
? ThemeHelper.GetToggleSwitchOnBackgroundBrush()
|
||||
: ThemeHelper.GetToggleSwitchOffBackgroundBrush();
|
||||
var innerBorder = toggleSwitch.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
@@ -198,9 +164,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ToggleSwitch点击事件处理
|
||||
/// </summary>
|
||||
private void ToggleSwitch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
@@ -208,7 +171,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
bool isOn = border.Background.ToString() == "#FF3584E4";
|
||||
bool isOn = ThemeHelper.IsToggleSwitchOn(border.Background);
|
||||
bool newState = !isOn;
|
||||
SetToggleSwitchState(border, newState);
|
||||
|
||||
@@ -218,77 +181,51 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
switch (tag)
|
||||
{
|
||||
case "AutoSaveStrokesAtClear":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAutoSaveStrokesAtClear", newState);
|
||||
break;
|
||||
|
||||
case "SaveScreenshotsInDateFolders":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchSaveScreenshotsInDateFolders", newState);
|
||||
break;
|
||||
|
||||
case "AutoSaveStrokesAtScreenshot":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAutoSaveStrokesAtScreenshot", newState);
|
||||
break;
|
||||
|
||||
case "AutoSaveScreenShotInPowerPoint":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAutoSaveScreenShotInPowerPoint", newState);
|
||||
break;
|
||||
|
||||
case "AutoDelSavedFiles":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAutoDelSavedFiles", newState);
|
||||
// 更新UI状态
|
||||
if (AutoDelIntervalPanel != null)
|
||||
{
|
||||
AutoDelIntervalPanel.Visibility = newState ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
break;
|
||||
|
||||
case "ShowCircleCenter":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchShowCircleCenter", newState);
|
||||
break;
|
||||
|
||||
case "FitToCurve":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchFitToCurve", newState);
|
||||
// 处理互斥逻辑
|
||||
if (newState)
|
||||
case "EnableAutoSaveStrokes":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableAutoSaveStrokes", newState);
|
||||
if (AutoSaveIntervalPanel != null)
|
||||
{
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAdvancedBezierSmoothing", false);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAdvancedBezierSmoothing"), false);
|
||||
AutoSaveIntervalPanel.Visibility = newState ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
break;
|
||||
|
||||
case "AdvancedBezierSmoothing":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAdvancedBezierSmoothing", newState);
|
||||
// 处理互斥逻辑
|
||||
if (newState)
|
||||
{
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchFitToCurve", false);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchFitToCurve"), false);
|
||||
}
|
||||
case "SaveFullPageStrokes":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchSaveFullPageStrokes", newState);
|
||||
break;
|
||||
|
||||
case "EnableInkFade":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableInkFade", newState);
|
||||
// 更新UI状态
|
||||
if (InkFadeTimePanel != null)
|
||||
{
|
||||
InkFadeTimePanel.Visibility = newState ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
case "SaveStrokesAsXML":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchSaveStrokesAsXML", newState);
|
||||
break;
|
||||
|
||||
case "AutoSaveStrokesInPowerPoint":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAutoSaveStrokesInPowerPoint", newState);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Slider值变化事件处理
|
||||
/// </summary>
|
||||
private void SideControlMinimumAutomationSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
@@ -296,32 +233,22 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
double value = SideControlMinimumAutomationSlider.Value;
|
||||
SideControlMinimumAutomationText.Text = value.ToString("F2");
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("SideControlMinimumAutomationSlider", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存路径文本框变化事件处理
|
||||
/// </summary>
|
||||
private void AutoSavedStrokesLocation_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
if (AutoSavedStrokesLocation != null)
|
||||
{
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeTextBoxTextChanged("AutoSavedStrokesLocation", AutoSavedStrokesLocation.Text);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 浏览按钮点击事件处理
|
||||
/// </summary>
|
||||
private void AutoSavedStrokesLocationButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeMainWindowMethod("AutoSavedStrokesLocationButton_Click", sender, e);
|
||||
// 同步新面板中的文本框
|
||||
if (AutoSavedStrokesLocation != null)
|
||||
{
|
||||
var mainWindow = Application.Current.MainWindow as MainWindow;
|
||||
@@ -336,14 +263,9 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置保存到 D:\Ink Canvas 按钮点击事件处理
|
||||
/// </summary>
|
||||
private void SetAutoSavedStrokesLocationToDiskDButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeMainWindowMethod("SetAutoSavedStrokesLocationToDiskDButton_Click", sender, e);
|
||||
// 同步新面板中的文本框
|
||||
if (AutoSavedStrokesLocation != null)
|
||||
{
|
||||
var mainWindow = Application.Current.MainWindow as MainWindow;
|
||||
@@ -358,9 +280,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置保存到文档按钮点击事件处理
|
||||
/// </summary>
|
||||
private void SetAutoSavedStrokesLocationToDocumentFolderButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (AutoSavedStrokesLocation != null)
|
||||
@@ -370,37 +289,17 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 墨迹渐隐时间滑块值变化事件处理
|
||||
/// </summary>
|
||||
private void InkFadeTimeSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
if (InkFadeTimeSlider != null && InkFadeTimeText != null)
|
||||
{
|
||||
int value = (int)InkFadeTimeSlider.Value;
|
||||
InkFadeTimeText.Text = $"{value}ms";
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("InkFadeTimeSlider", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ComboBox选择变化事件处理
|
||||
/// </summary>
|
||||
private void ComboBoxAutoDelSavedFilesDaysThreshold_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
if (ComboBoxAutoDelSavedFilesDaysThreshold?.SelectedItem is ComboBoxItem selectedItem)
|
||||
{
|
||||
// 调用 MainWindow 中的方法
|
||||
var mainWindow = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow != null)
|
||||
{
|
||||
var comboBox = mainWindow.FindName("ComboBoxAutoDelSavedFilesDaysThreshold") as System.Windows.Controls.ComboBox;
|
||||
if (comboBox != null)
|
||||
{
|
||||
// 找到对应的选项并设置
|
||||
string tag = selectedItem.Tag?.ToString();
|
||||
if (!string.IsNullOrEmpty(tag) && tag.StartsWith("AutoDelSavedFilesDaysThreshold_"))
|
||||
{
|
||||
@@ -418,7 +317,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置
|
||||
string tag = selectedItem.Tag?.ToString();
|
||||
if (!string.IsNullOrEmpty(tag) && tag.StartsWith("AutoDelSavedFilesDaysThreshold_"))
|
||||
{
|
||||
@@ -439,51 +337,151 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
LoadAutoSaveIntervalSettings();
|
||||
|
||||
// 为所有 ComboBox 添加 DropDownOpened 事件处理,以便在下拉菜单打开时更新颜色
|
||||
UpdateComboBoxDropdownTheme(ComboBoxAutoDelSavedFilesDaysThreshold);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"SnapshotPanel 应用主题时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"SnapshotPanel 应用主题时出�? {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为 ComboBox 添加下拉菜单主题更新
|
||||
/// </summary>
|
||||
private void UpdateComboBoxDropdownTheme(System.Windows.Controls.ComboBox comboBox)
|
||||
{
|
||||
if (comboBox == null) return;
|
||||
|
||||
// 移除旧的事件处理(如果存在)
|
||||
comboBox.DropDownOpened -= ComboBox_DropDownOpened;
|
||||
// 添加新的事件处理
|
||||
comboBox.DropDownOpened += ComboBox_DropDownOpened;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ComboBox 下拉菜单打开事件处理
|
||||
/// </summary>
|
||||
private void ComboBox_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
if (sender is System.Windows.Controls.ComboBox comboBox)
|
||||
{
|
||||
// 延迟更新,确保 Popup 已经完全创建
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
ThemeHelper.UpdateComboBoxDropdownColors(comboBox);
|
||||
}), System.Windows.Threading.DispatcherPriority.Loaded);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadAutoSaveIntervalSettings()
|
||||
{
|
||||
if (MainWindow.Settings?.Automation == null) return;
|
||||
|
||||
int interval = MainWindow.Settings.Automation.AutoSaveStrokesIntervalMinutes;
|
||||
var intervalButtons = new[] {
|
||||
AutoSaveStrokesInterval1MinBorder,
|
||||
AutoSaveStrokesInterval3MinBorder,
|
||||
AutoSaveStrokesInterval5MinBorder,
|
||||
AutoSaveStrokesInterval10MinBorder,
|
||||
AutoSaveStrokesInterval15MinBorder,
|
||||
AutoSaveStrokesInterval30MinBorder,
|
||||
AutoSaveStrokesInterval60MinBorder
|
||||
};
|
||||
|
||||
foreach (var button in intervalButtons)
|
||||
{
|
||||
if (button != null)
|
||||
{
|
||||
ThemeHelper.SetOptionButtonSelectedState(button, false);
|
||||
}
|
||||
}
|
||||
|
||||
System.Windows.Controls.Border selectedButton = null;
|
||||
switch (interval)
|
||||
{
|
||||
case 1: selectedButton = AutoSaveStrokesInterval1MinBorder; break;
|
||||
case 3: selectedButton = AutoSaveStrokesInterval3MinBorder; break;
|
||||
case 5: selectedButton = AutoSaveStrokesInterval5MinBorder; break;
|
||||
case 10: selectedButton = AutoSaveStrokesInterval10MinBorder; break;
|
||||
case 15: selectedButton = AutoSaveStrokesInterval15MinBorder; break;
|
||||
case 30: selectedButton = AutoSaveStrokesInterval30MinBorder; break;
|
||||
case 60: selectedButton = AutoSaveStrokesInterval60MinBorder; break;
|
||||
default: selectedButton = AutoSaveStrokesInterval5MinBorder; break;
|
||||
}
|
||||
|
||||
if (selectedButton != null)
|
||||
{
|
||||
ThemeHelper.SetOptionButtonSelectedState(selectedButton, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void AutoSaveIntervalButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
string tag = border.Tag?.ToString();
|
||||
if (string.IsNullOrEmpty(tag)) return;
|
||||
|
||||
string[] parts = tag.Split('_');
|
||||
if (parts.Length < 2) return;
|
||||
|
||||
string group = parts[0];
|
||||
string value = parts[1];
|
||||
|
||||
var parent = border.Parent as Panel;
|
||||
if (parent != null)
|
||||
{
|
||||
foreach (var child in parent.Children)
|
||||
{
|
||||
if (child is Border childBorder && childBorder != border)
|
||||
{
|
||||
string childTag = childBorder.Tag?.ToString();
|
||||
if (!string.IsNullOrEmpty(childTag) && childTag.StartsWith(group + "_"))
|
||||
{
|
||||
ThemeHelper.SetOptionButtonSelectedState(childBorder, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ThemeHelper.SetOptionButtonSelectedState(border, true);
|
||||
|
||||
int interval = int.Parse(value);
|
||||
var mainWindow = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow != null)
|
||||
{
|
||||
var comboBox = mainWindow.FindName("ComboBoxAutoSaveStrokesInterval") as System.Windows.Controls.ComboBox;
|
||||
if (comboBox != null)
|
||||
{
|
||||
foreach (System.Windows.Controls.ComboBoxItem item in comboBox.Items)
|
||||
{
|
||||
if (item.Tag != null && int.TryParse(item.Tag.ToString(), out int tagValue) && tagValue == interval)
|
||||
{
|
||||
comboBox.SelectedItem = item;
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChanged("ComboBoxAutoSaveStrokesInterval", item);
|
||||
break;
|
||||
}
|
||||
else if (item.Content != null && item.Content.ToString().Contains(interval.ToString()))
|
||||
{
|
||||
comboBox.SelectedItem = item;
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChanged("ComboBoxAutoSaveStrokesInterval", item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
if (MainWindow.Settings.Automation != null)
|
||||
{
|
||||
MainWindow.Settings.Automation.AutoSaveStrokesIntervalMinutes = interval;
|
||||
}
|
||||
}, "ComboBoxAutoSaveStrokesInterval");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="ComboBoxStyles.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<!-- 开关样式模板 -->
|
||||
<Style x:Key="ToggleSwitchStyle" TargetType="Border">
|
||||
<Setter Property="Width" Value="48"/>
|
||||
<Setter Property="Height" Value="25"/>
|
||||
@@ -27,7 +26,6 @@
|
||||
</UserControl.Resources>
|
||||
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="ScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
|
||||
<StackPanel Margin="60,12,60,24">
|
||||
<!-- 窗口设置 -->
|
||||
<Border BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
@@ -36,7 +34,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="窗口失去焦点时仍可接收输入" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchNoFocusMode" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="NoFocusMode" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -50,7 +48,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="隐藏窗口边框,提供更沉浸的体验" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchWindowMode" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="WindowMode" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -64,7 +62,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="窗口始终显示在其他窗口之上" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAlwaysOnTop" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="AlwaysOnTop" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -78,7 +76,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="使用UIA方式实现置顶,需要管理员权限" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchUIAccessTopMost" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="UIAccessTopMost" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -88,7 +86,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 更新设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
@@ -97,7 +94,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="定期检查是否有新版本可用" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchIsAutoUpdate" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="IsAutoUpdate" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -111,7 +108,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在软件不使用时自动安装更新,无需手动操作" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchIsAutoUpdateWithSilence" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="IsAutoUpdateWithSilence" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -125,7 +122,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="选择更新通道:稳定版提供可靠更新,测试版提供新功能抢先体验" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<WrapPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Border x:Name="UpdateChannelReleaseBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="UpdateChannel_Release" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<Border x:Name="UpdateChannelReleaseBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="UpdateChannel_Release" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="稳定版"/>
|
||||
</Border>
|
||||
<Border x:Name="UpdateChannelBetaBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="UpdateChannel_Beta" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
@@ -240,7 +237,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 启动设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
@@ -249,7 +245,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="系统启动时自动运行软件" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchRunAtStartup" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="RunAtStartup" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -263,7 +259,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开机启动后自动收纳到侧边栏" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchFoldAtStartup" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="FoldAtStartup" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -273,7 +269,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 模式设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="选择软件运行模式。仅PPT模式下,软件将完全隐藏,仅在PPT放映时出现。(实验性功能,可能不稳定。)"
|
||||
@@ -284,7 +279,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="启用后,软件将完全隐藏,仅在PPT放映时出现" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchMode" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="Mode" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -294,7 +289,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 插件管理 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="通过插件扩展InkCanvas的功能。您可以启用或禁用插件,或加载自定义插件。"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Ink_Canvas;
|
||||
using Ink_Canvas;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using System;
|
||||
using System.Linq;
|
||||
@@ -8,9 +8,6 @@ using System.Windows.Media;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
/// <summary>
|
||||
/// StartupPanel.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class StartupPanel : UserControl
|
||||
{
|
||||
private bool _isLoaded = false;
|
||||
@@ -24,21 +21,14 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
private void StartupPanel_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LoadSettings();
|
||||
// 添加触摸支持
|
||||
EnableTouchSupport();
|
||||
// 应用主题
|
||||
ApplyTheme();
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为面板中的所有交互控件启用触摸支持
|
||||
/// </summary>
|
||||
private void EnableTouchSupport()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 延迟执行,确保所有控件都已加载
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
EnableTouchSupportForControls(this);
|
||||
@@ -46,16 +36,11 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"StartupPanel 启用触摸支持时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"StartupPanel 启用触摸支持时出�? {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为控件树中的所有交互控件启用触摸支持
|
||||
/// </summary>
|
||||
private void EnableTouchSupportForControls(System.Windows.DependencyObject parent)
|
||||
{
|
||||
// 使用 MainWindowSettingsHelper 的通用方法
|
||||
MainWindowSettingsHelper.EnableTouchSupportForControls(parent);
|
||||
}
|
||||
|
||||
@@ -74,10 +59,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载设置到UI
|
||||
/// </summary>
|
||||
public void LoadSettings()
|
||||
{
|
||||
if (MainWindow.Settings == null) return;
|
||||
@@ -86,15 +67,12 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
|
||||
try
|
||||
{
|
||||
// 自动更新设置
|
||||
var toggleSwitchIsAutoUpdate = FindToggleSwitch("ToggleSwitchIsAutoUpdate");
|
||||
if (toggleSwitchIsAutoUpdate != null)
|
||||
{
|
||||
bool isAutoUpdate = MainWindow.Settings.Startup.IsAutoUpdate;
|
||||
SetToggleSwitchState(toggleSwitchIsAutoUpdate, isAutoUpdate);
|
||||
}
|
||||
|
||||
// 静默更新设置
|
||||
var toggleSwitchIsAutoUpdateWithSilence = FindToggleSwitch("ToggleSwitchIsAutoUpdateWithSilence");
|
||||
if (toggleSwitchIsAutoUpdateWithSilence != null)
|
||||
{
|
||||
@@ -102,17 +80,11 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
SetToggleSwitchState(toggleSwitchIsAutoUpdateWithSilence, isAutoUpdateWithSilence);
|
||||
toggleSwitchIsAutoUpdateWithSilence.Visibility = MainWindow.Settings.Startup.IsAutoUpdate ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
|
||||
// 静默更新时间段
|
||||
if (AutoUpdateTimePeriodBlock != null)
|
||||
{
|
||||
AutoUpdateTimePeriodBlock.Visibility =
|
||||
(MainWindow.Settings.Startup.IsAutoUpdateWithSilence && MainWindow.Settings.Startup.IsAutoUpdate) ?
|
||||
Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
|
||||
// 设置时间选择器
|
||||
if (AutoUpdateWithSilenceStartTimeComboBox != null)
|
||||
{
|
||||
var startTime = MainWindow.Settings.Startup.AutoUpdateWithSilenceStartTime ?? "06:00";
|
||||
var startItem = AutoUpdateWithSilenceStartTimeComboBox.Items.Cast<ComboBoxItem>()
|
||||
@@ -133,53 +105,38 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
AutoUpdateWithSilenceEndTimeComboBox.SelectedItem = endItem;
|
||||
}
|
||||
}
|
||||
|
||||
// 开机时运行
|
||||
var toggleSwitchRunAtStartup = FindToggleSwitch("ToggleSwitchRunAtStartup");
|
||||
if (toggleSwitchRunAtStartup != null)
|
||||
{
|
||||
// 检查启动项是否存在
|
||||
bool runAtStartup = System.IO.File.Exists(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\Ink Canvas Annotation.lnk");
|
||||
SetToggleSwitchState(toggleSwitchRunAtStartup, runAtStartup);
|
||||
}
|
||||
|
||||
// 启动时折叠
|
||||
var toggleSwitchFoldAtStartup = FindToggleSwitch("ToggleSwitchFoldAtStartup");
|
||||
if (toggleSwitchFoldAtStartup != null)
|
||||
{
|
||||
SetToggleSwitchState(toggleSwitchFoldAtStartup, MainWindow.Settings.Startup.IsFoldAtStartup);
|
||||
}
|
||||
|
||||
// 窗口无焦点模式
|
||||
var toggleSwitchNoFocusMode = FindToggleSwitch("ToggleSwitchNoFocusMode");
|
||||
if (toggleSwitchNoFocusMode != null && MainWindow.Settings.Advanced != null)
|
||||
{
|
||||
SetToggleSwitchState(toggleSwitchNoFocusMode, MainWindow.Settings.Advanced.IsNoFocusMode);
|
||||
}
|
||||
|
||||
// 窗口无边框模式
|
||||
var toggleSwitchWindowMode = FindToggleSwitch("ToggleSwitchWindowMode");
|
||||
if (toggleSwitchWindowMode != null && MainWindow.Settings.Advanced != null)
|
||||
{
|
||||
SetToggleSwitchState(toggleSwitchWindowMode, MainWindow.Settings.Advanced.WindowMode);
|
||||
}
|
||||
|
||||
// 窗口置顶
|
||||
var toggleSwitchAlwaysOnTop = FindToggleSwitch("ToggleSwitchAlwaysOnTop");
|
||||
if (toggleSwitchAlwaysOnTop != null && MainWindow.Settings.Advanced != null)
|
||||
{
|
||||
SetToggleSwitchState(toggleSwitchAlwaysOnTop, MainWindow.Settings.Advanced.IsAlwaysOnTop);
|
||||
}
|
||||
|
||||
// UIA置顶
|
||||
var toggleSwitchUIAccessTopMost = FindToggleSwitch("ToggleSwitchUIAccessTopMost");
|
||||
if (toggleSwitchUIAccessTopMost != null && MainWindow.Settings.Advanced != null)
|
||||
{
|
||||
SetToggleSwitchState(toggleSwitchUIAccessTopMost, MainWindow.Settings.Advanced.EnableUIAccessTopMost);
|
||||
}
|
||||
|
||||
// 更新通道
|
||||
if (MainWindow.Settings.Startup.UpdateChannel == UpdateChannel.Release)
|
||||
{
|
||||
UpdateUpdateChannelButtons(true);
|
||||
@@ -188,8 +145,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
UpdateUpdateChannelButtons(false);
|
||||
}
|
||||
|
||||
// 仅PPT模式
|
||||
var toggleSwitchMode = FindToggleSwitch("ToggleSwitchMode");
|
||||
if (toggleSwitchMode != null && MainWindow.Settings.ModeSettings != null)
|
||||
{
|
||||
@@ -198,39 +153,27 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"加载启动设置时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"加载启动设置时出�? {ex.Message}");
|
||||
}
|
||||
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找ToggleSwitch控件
|
||||
/// </summary>
|
||||
private Border FindToggleSwitch(string name)
|
||||
{
|
||||
return this.FindDescendantByName(name) as Border;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置ToggleSwitch状态
|
||||
/// </summary>
|
||||
private void SetToggleSwitchState(Border toggleSwitch, bool isOn)
|
||||
{
|
||||
if (toggleSwitch == null) return;
|
||||
toggleSwitch.Background = isOn
|
||||
? new SolidColorBrush(Color.FromRgb(53, 132, 228))
|
||||
: ThemeHelper.GetButtonBackgroundBrush();
|
||||
? ThemeHelper.GetToggleSwitchOnBackgroundBrush()
|
||||
: ThemeHelper.GetToggleSwitchOffBackgroundBrush();
|
||||
var innerBorder = toggleSwitch.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
innerBorder.HorizontalAlignment = isOn ? HorizontalAlignment.Right : HorizontalAlignment.Left;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ToggleSwitch点击事件处理
|
||||
/// </summary>
|
||||
private void ToggleSwitch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
@@ -238,7 +181,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
bool isOn = border.Background.ToString() == "#FF3584E4";
|
||||
bool isOn = ThemeHelper.IsToggleSwitchOn(border.Background);
|
||||
bool newState = !isOn;
|
||||
SetToggleSwitchState(border, newState);
|
||||
|
||||
@@ -248,9 +191,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
switch (tag)
|
||||
{
|
||||
case "IsAutoUpdate":
|
||||
// 直接调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchIsAutoUpdate", newState);
|
||||
// 更新UI状态
|
||||
var toggleSwitchIsAutoUpdateWithSilence = FindToggleSwitch("ToggleSwitchIsAutoUpdateWithSilence");
|
||||
if (toggleSwitchIsAutoUpdateWithSilence != null)
|
||||
{
|
||||
@@ -265,45 +206,32 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
break;
|
||||
|
||||
case "IsAutoUpdateWithSilence":
|
||||
// 直接调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchIsAutoUpdateWithSilence", newState);
|
||||
// 更新UI状态
|
||||
if (AutoUpdateTimePeriodBlock != null)
|
||||
{
|
||||
AutoUpdateTimePeriodBlock.Visibility = newState ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
break;
|
||||
|
||||
case "RunAtStartup":
|
||||
// 直接调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchRunAtStartup", newState);
|
||||
break;
|
||||
|
||||
case "FoldAtStartup":
|
||||
// 直接调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchFoldAtStartup", newState);
|
||||
break;
|
||||
|
||||
case "NoFocusMode":
|
||||
// 窗口无焦点模式
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
if (MainWindow.Settings.Advanced != null)
|
||||
{
|
||||
if (MainWindow.Settings.Advanced != null)
|
||||
{
|
||||
MainWindow.Settings.Advanced.IsNoFocusMode = newState;
|
||||
}
|
||||
}, "ToggleSwitchNoFocusMode");
|
||||
// 调用 ApplyNoFocusMode 方法
|
||||
MainWindow.Settings.Advanced.IsNoFocusMode = newState;
|
||||
}
|
||||
MainWindowSettingsHelper.InvokeMainWindowMethod("ApplyNoFocusMode");
|
||||
break;
|
||||
|
||||
case "WindowMode":
|
||||
// 窗口无边框模式
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchWindowMode", newState);
|
||||
break;
|
||||
|
||||
case "AlwaysOnTop":
|
||||
// 窗口置顶
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
if (MainWindow.Settings.Advanced != null)
|
||||
@@ -311,12 +239,10 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
MainWindow.Settings.Advanced.IsAlwaysOnTop = newState;
|
||||
}
|
||||
}, "ToggleSwitchAlwaysOnTop");
|
||||
// 调用 SetAlwaysOnTop 方法(如果存在)
|
||||
MainWindowSettingsHelper.InvokeMainWindowMethod("SetAlwaysOnTop", newState);
|
||||
break;
|
||||
|
||||
case "UIAccessTopMost":
|
||||
// UIA置顶
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
if (MainWindow.Settings.Advanced != null)
|
||||
@@ -327,15 +253,10 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
break;
|
||||
|
||||
case "Mode":
|
||||
// 仅PPT模式
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchMode", newState);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选项按钮点击事件处理
|
||||
/// </summary>
|
||||
private void OptionButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
@@ -349,66 +270,36 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
switch (tag)
|
||||
{
|
||||
case "UpdateChannel_Release":
|
||||
// 选择稳定版
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
MainWindow.Settings.Startup.UpdateChannel = UpdateChannel.Release;
|
||||
}, "UpdateChannelSelector");
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeMainWindowMethod("UpdateChannelSelector_Checked",
|
||||
new System.Windows.Controls.RadioButton { Tag = "Release" }, e);
|
||||
// 更新UI状态
|
||||
UpdateUpdateChannelButtons(true);
|
||||
MainWindowSettingsHelper.InvokeMainWindowMethod("UpdateChannelSelector_Checked",
|
||||
new System.Windows.Controls.RadioButton { Tag = "Release" }, e);
|
||||
UpdateUpdateChannelButtons(true);
|
||||
}
|
||||
break;
|
||||
|
||||
case "UpdateChannel_Beta":
|
||||
// 选择测试版
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
MainWindow.Settings.Startup.UpdateChannel = UpdateChannel.Beta;
|
||||
}, "UpdateChannelSelector");
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeMainWindowMethod("UpdateChannelSelector_Checked",
|
||||
new System.Windows.Controls.RadioButton { Tag = "Beta" }, e);
|
||||
// 更新UI状态
|
||||
UpdateUpdateChannelButtons(false);
|
||||
MainWindowSettingsHelper.InvokeMainWindowMethod("UpdateChannelSelector_Checked",
|
||||
new System.Windows.Controls.RadioButton { Tag = "Beta" }, e);
|
||||
UpdateUpdateChannelButtons(false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新更新通道按钮状态
|
||||
/// </summary>
|
||||
private void UpdateUpdateChannelButtons(bool isReleaseSelected)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool isDarkTheme = ThemeHelper.IsDarkTheme;
|
||||
|
||||
if (UpdateChannelReleaseBorder != null)
|
||||
{
|
||||
UpdateChannelReleaseBorder.Background = isReleaseSelected
|
||||
? (isDarkTheme ? ThemeHelper.GetButtonBackgroundBrush() : new SolidColorBrush(Color.FromRgb(225, 225, 225)))
|
||||
: (isDarkTheme ? new SolidColorBrush(Color.FromRgb(35, 35, 35)) : new SolidColorBrush(Colors.Transparent));
|
||||
var textBlock = UpdateChannelReleaseBorder.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = isReleaseSelected ? FontWeights.Bold : FontWeights.Normal;
|
||||
textBlock.Foreground = ThemeHelper.GetTextPrimaryBrush();
|
||||
}
|
||||
ThemeHelper.SetOptionButtonSelectedState(UpdateChannelReleaseBorder, isReleaseSelected);
|
||||
}
|
||||
|
||||
if (UpdateChannelBetaBorder != null)
|
||||
{
|
||||
UpdateChannelBetaBorder.Background = !isReleaseSelected
|
||||
? (isDarkTheme ? ThemeHelper.GetButtonBackgroundBrush() : new SolidColorBrush(Color.FromRgb(225, 225, 225)))
|
||||
: (isDarkTheme ? new SolidColorBrush(Color.FromRgb(35, 35, 35)) : new SolidColorBrush(Colors.Transparent));
|
||||
var textBlock = UpdateChannelBetaBorder.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = !isReleaseSelected ? FontWeights.Bold : FontWeights.Normal;
|
||||
textBlock.Foreground = ThemeHelper.GetTextPrimaryBrush();
|
||||
}
|
||||
ThemeHelper.SetOptionButtonSelectedState(UpdateChannelBetaBorder, !isReleaseSelected);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -416,83 +307,43 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
System.Diagnostics.Debug.WriteLine($"更新更新通道按钮状态时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 手动更新按钮点击事件
|
||||
/// </summary>
|
||||
private async void ManualUpdateButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MainWindowSettingsHelper.InvokeMainWindowMethod("ManualUpdateButton_Click", sender, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 版本修复按钮点击事件
|
||||
/// </summary>
|
||||
private async void FixVersionButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MainWindowSettingsHelper.InvokeMainWindowMethod("FixVersionButton_Click", sender, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 历史版本回滚按钮点击事件
|
||||
/// </summary>
|
||||
private void HistoryRollbackButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// 查找 MainWindow 中的历史版本回滚方法
|
||||
MainWindowSettingsHelper.InvokeMainWindowMethod("HistoryRollbackButton_Click", sender, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ComboBox选择变化事件处理
|
||||
/// </summary>
|
||||
private void AutoUpdateWithSilenceStartTimeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
// 直接调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChanged("AutoUpdateWithSilenceStartTimeComboBox", AutoUpdateWithSilenceStartTimeComboBox?.SelectedItem);
|
||||
}
|
||||
|
||||
private void AutoUpdateWithSilenceEndTimeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
// 直接调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChanged("AutoUpdateWithSilenceEndTimeComboBox", AutoUpdateWithSilenceEndTimeComboBox?.SelectedItem);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
bool isDarkTheme = ThemeHelper.IsDarkTheme;
|
||||
|
||||
// 更新更新通道按钮
|
||||
if (UpdateChannelReleaseBorder != null)
|
||||
// 更新更新通道按钮状态
|
||||
if (MainWindow.Settings.Startup.UpdateChannel == UpdateChannel.Release)
|
||||
{
|
||||
UpdateChannelReleaseBorder.Background = isDarkTheme
|
||||
? ThemeHelper.GetButtonBackgroundBrush()
|
||||
: new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var textBlock = UpdateChannelReleaseBorder.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.Foreground = ThemeHelper.GetTextPrimaryBrush();
|
||||
}
|
||||
UpdateUpdateChannelButtons(true);
|
||||
}
|
||||
if (UpdateChannelBetaBorder != null)
|
||||
else
|
||||
{
|
||||
UpdateChannelBetaBorder.Background = isDarkTheme
|
||||
? new SolidColorBrush(Color.FromRgb(35, 35, 35))
|
||||
: new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = UpdateChannelBetaBorder.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.Foreground = ThemeHelper.GetTextPrimaryBrush();
|
||||
}
|
||||
UpdateUpdateChannelButtons(false);
|
||||
}
|
||||
|
||||
// 更新按钮
|
||||
if (ManualUpdateButton != null)
|
||||
{
|
||||
ManualUpdateButton.Background = ThemeHelper.GetButtonBackgroundBrush();
|
||||
@@ -508,41 +359,25 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
HistoryRollbackButton.Background = ThemeHelper.GetButtonBackgroundBrush();
|
||||
HistoryRollbackButton.Foreground = ThemeHelper.GetTextPrimaryBrush();
|
||||
}
|
||||
|
||||
// 使用 ThemeHelper 递归更新其他元素
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
|
||||
// 为所有 ComboBox 添加 DropDownOpened 事件处理,以便在下拉菜单打开时更新颜色
|
||||
UpdateComboBoxDropdownTheme(AutoUpdateWithSilenceStartTimeComboBox);
|
||||
UpdateComboBoxDropdownTheme(AutoUpdateWithSilenceEndTimeComboBox);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"StartupPanel 应用主题时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"StartupPanel 应用主题时出�? {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为 ComboBox 添加下拉菜单主题更新
|
||||
/// </summary>
|
||||
private void UpdateComboBoxDropdownTheme(System.Windows.Controls.ComboBox comboBox)
|
||||
{
|
||||
if (comboBox == null) return;
|
||||
|
||||
// 移除旧的事件处理(如果存在)
|
||||
comboBox.DropDownOpened -= ComboBox_DropDownOpened;
|
||||
// 添加新的事件处理
|
||||
comboBox.DropDownOpened += ComboBox_DropDownOpened;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ComboBox 下拉菜单打开事件处理
|
||||
/// </summary>
|
||||
private void ComboBox_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
if (sender is System.Windows.Controls.ComboBox comboBox)
|
||||
{
|
||||
// 延迟更新,确保 Popup 已经完全创建
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
ThemeHelper.UpdateComboBoxDropdownColors(comboBox);
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
d:DesignHeight="950" d:DesignWidth="640">
|
||||
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="ScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
|
||||
<StackPanel Margin="60,12,60,24">
|
||||
<!-- 设置项已清空,仅保留页面框架 -->
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
/// <summary>
|
||||
/// StoragePanel.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class StoragePanel : UserControl
|
||||
{
|
||||
public StoragePanel()
|
||||
@@ -29,10 +26,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
@@ -41,7 +34,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"StoragePanel 应用主题时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"StoragePanel 应用主题时出�? {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -12,7 +12,6 @@
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="ComboBoxStyles.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<!-- 开关样式模板 -->
|
||||
<Style x:Key="ToggleSwitchStyle" TargetType="Border">
|
||||
<Setter Property="Width" Value="48"/>
|
||||
<Setter Property="Height" Value="25"/>
|
||||
@@ -27,7 +26,6 @@
|
||||
</UserControl.Resources>
|
||||
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="ScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
|
||||
<StackPanel Margin="60,12,60,24">
|
||||
<!-- 主题设置 -->
|
||||
<Border BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
@@ -42,7 +40,7 @@
|
||||
<Border x:Name="ThemeDarkBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="Theme_Dark" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="深色主题"/>
|
||||
</Border>
|
||||
<Border x:Name="ThemeSystemBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="Theme_System" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<Border x:Name="ThemeSystemBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="Theme_System" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="跟随系统"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
@@ -50,7 +48,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 启动动画设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
@@ -59,7 +56,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="启动时显示动画效果" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableSplashScreen" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="EnableSplashScreen" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -90,7 +87,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 浮动工具栏设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<StackPanel Margin="18,8,18,8">
|
||||
@@ -167,7 +163,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在调色盘窗口中显示笔尖模式切换按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableDisPlayNibModeToggle" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="EnableDisPlayNibModeToggle" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -185,7 +181,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 浮动栏按钮显示设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="浮动栏按钮显示" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
@@ -270,7 +265,7 @@
|
||||
<Border x:Name="QuickColorPaletteDisplayModeSingleBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="QuickColorPaletteDisplayMode_Single" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="单行显示(6色)"/>
|
||||
</Border>
|
||||
<Border x:Name="QuickColorPaletteDisplayModeDoubleBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="QuickColorPaletteDisplayMode_Double" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<Border x:Name="QuickColorPaletteDisplayModeDoubleBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="QuickColorPaletteDisplayMode_Double" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="双行显示(8色)"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
@@ -282,7 +277,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="选择橡皮按钮的显示方式" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<WrapPanel Orientation="Horizontal" Margin="0,0,0,8">
|
||||
<Border x:Name="EraserDisplayOptionBothBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="EraserDisplayOption_Both" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<Border x:Name="EraserDisplayOptionBothBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="EraserDisplayOption_Both" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="两个都显示"/>
|
||||
</Border>
|
||||
<Border x:Name="EraserDisplayOptionAreaBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="EraserDisplayOption_Area" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
@@ -299,7 +294,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 任务栏托盘图标设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="任务栏托盘图标" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
@@ -309,7 +303,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在任务栏系统托盘显示图标" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableTrayIcon" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnableTrayIcon" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -319,7 +313,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 白板设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="白板设置" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
@@ -329,7 +322,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="将白板界面缩放至80%" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableViewboxBlackBoardScaleTransform" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnableViewboxBlackBoardScaleTransform" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -343,7 +336,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在白板界面显示当前时间和日期" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableTimeDisplayInWhiteboardMode" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnableTimeDisplayInWhiteboardMode" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -357,7 +350,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在白板界面显示励志语句" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableChickenSoupInWhiteboardMode" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnableChickenSoupInWhiteboardMode" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -380,7 +373,7 @@
|
||||
<Border x:Name="ChickenSoupSourceGaokaoBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="ChickenSoupSource_Gaokao" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="高考祝福语"/>
|
||||
</Border>
|
||||
<Border x:Name="ChickenSoupSourceHitokotoBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="ChickenSoupSource_Hitokoto" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<Border x:Name="ChickenSoupSourceHitokotoBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="ChickenSoupSource_Hitokoto" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="一言(Hitokoto API)"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
@@ -388,7 +381,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 收纳模式设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="收纳模式设置" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
@@ -398,7 +390,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在收纳模式下显示快速操作面板" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableQuickPanel" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnableQuickPanel" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -412,7 +404,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="选择取消收纳按钮的图标样式" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<WrapPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Border x:Name="UnFoldBtnImgArrowBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="UnFoldBtnImg_Arrow" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<Border x:Name="UnFoldBtnImgArrowBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="UnFoldBtnImg_Arrow" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="箭头"/>
|
||||
</Border>
|
||||
<Border x:Name="UnFoldBtnImgPenBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="UnFoldBtnImg_Pen" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
@@ -427,7 +419,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后,退出收纳模式时将自动切换至批注模式,便于快速批注" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoEnterAnnotationModeWhenExitFoldMode" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="AutoEnterAnnotationModeWhenExitFoldMode" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -441,7 +433,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后,退出PPT放映后会自动收纳浮动栏" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoFoldAfterPPTSlideShow" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="AutoFoldAfterPPTSlideShow" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -455,7 +447,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后,退出白板模式时会自动收纳到侧边栏" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoFoldWhenExitWhiteboard" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="AutoFoldWhenExitWhiteboard" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Ink_Canvas;
|
||||
using Ink_Canvas;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -11,9 +11,6 @@ using Hardcodet.Wpf.TaskbarNotification;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
/// <summary>
|
||||
/// ThemePanel.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ThemePanel : UserControl
|
||||
{
|
||||
private bool _isLoaded = false;
|
||||
@@ -27,21 +24,15 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
private void ThemePanel_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LoadSettings();
|
||||
// 添加触摸支持
|
||||
EnableTouchSupport();
|
||||
// 应用主题
|
||||
ApplyTheme();
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为面板中的所有交互控件启用触摸支持
|
||||
/// </summary>
|
||||
private void EnableTouchSupport()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 延迟执行,确保所有控件都已加载
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
MainWindowSettingsHelper.EnableTouchSupportForControls(this);
|
||||
@@ -49,7 +40,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"ThemePanel 启用触摸支持时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"ThemePanel 启用触摸支持时出�? {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,9 +61,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载设置到UI
|
||||
/// </summary>
|
||||
public void LoadSettings()
|
||||
{
|
||||
if (MainWindow.Settings == null || MainWindow.Settings.Appearance == null) return;
|
||||
@@ -83,33 +71,25 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
var appearance = MainWindow.Settings.Appearance;
|
||||
|
||||
// 主题设置
|
||||
SetOptionButtonState("Theme", appearance.Theme);
|
||||
|
||||
// 启用启动动画
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableSplashScreen"), appearance.EnableSplashScreen);
|
||||
if (SplashScreenStylePanel != null)
|
||||
{
|
||||
SplashScreenStylePanel.Visibility = appearance.EnableSplashScreen ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
|
||||
// 启动动画样式
|
||||
if (ComboBoxSplashScreenStyle != null)
|
||||
{
|
||||
ComboBoxSplashScreenStyle.SelectedIndex = Math.Min(appearance.SplashScreenStyle, ComboBoxSplashScreenStyle.Items.Count - 1);
|
||||
}
|
||||
|
||||
// 浮动工具栏图标
|
||||
if (ComboBoxFloatingBarImg != null)
|
||||
{
|
||||
// 更新自定义图标列表(如果需要)
|
||||
// UpdateCustomIconsInComboBox();
|
||||
|
||||
int selectedIndex = Math.Min(appearance.FloatingBarImg, ComboBoxFloatingBarImg.Items.Count - 1);
|
||||
ComboBoxFloatingBarImg.SelectedIndex = selectedIndex;
|
||||
}
|
||||
|
||||
// 浮动工具栏缩放
|
||||
if (ViewboxFloatingBarScaleTransformValueSlider != null)
|
||||
{
|
||||
double val = appearance.ViewboxFloatingBarScaleTransformValue;
|
||||
@@ -121,7 +101,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
// 浮动工具栏透明度
|
||||
if (ViewboxFloatingBarOpacityValueSlider != null)
|
||||
{
|
||||
ViewboxFloatingBarOpacityValueSlider.Value = appearance.ViewboxFloatingBarOpacityValue;
|
||||
@@ -131,7 +110,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
// 浮栏在PPT下透明度
|
||||
if (ViewboxFloatingBarOpacityInPPTValueSlider != null)
|
||||
{
|
||||
ViewboxFloatingBarOpacityInPPTValueSlider.Value = appearance.ViewboxFloatingBarOpacityInPPTValue;
|
||||
@@ -141,16 +119,13 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
// 在调色盘窗口中显示笔尖模式按钮
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableDisPlayNibModeToggle"), appearance.IsEnableDisPlayNibModeToggler);
|
||||
|
||||
// 使用老版浮动栏按钮UI
|
||||
if (CheckBoxUseLegacyFloatingBarUI != null)
|
||||
{
|
||||
CheckBoxUseLegacyFloatingBarUI.IsChecked = appearance.UseLegacyFloatingBarUI;
|
||||
}
|
||||
|
||||
// 浮动栏按钮显示控制
|
||||
if (CheckBoxShowShapeButton != null) CheckBoxShowShapeButton.IsChecked = appearance.IsShowShapeButton;
|
||||
if (CheckBoxShowUndoButton != null) CheckBoxShowUndoButton.IsChecked = appearance.IsShowUndoButton;
|
||||
if (CheckBoxShowRedoButton != null) CheckBoxShowRedoButton.IsChecked = appearance.IsShowRedoButton;
|
||||
@@ -161,76 +136,58 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
if (CheckBoxShowLassoSelectButton != null) CheckBoxShowLassoSelectButton.IsChecked = appearance.IsShowLassoSelectButton;
|
||||
if (CheckBoxShowClearAndMouseButton != null) CheckBoxShowClearAndMouseButton.IsChecked = appearance.IsShowClearAndMouseButton;
|
||||
|
||||
// 启用系统托盘图标
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableTrayIcon"), appearance.EnableTrayIcon);
|
||||
|
||||
// 画板UI缩放
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableViewboxBlackBoardScaleTransform"), appearance.EnableViewboxBlackBoardScaleTransform);
|
||||
|
||||
// 白板模式时间显示
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableTimeDisplayInWhiteboardMode"), appearance.EnableTimeDisplayInWhiteboardMode);
|
||||
|
||||
// 白板模式鸡汤文
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableChickenSoupInWhiteboardMode"), appearance.EnableChickenSoupInWhiteboardMode);
|
||||
|
||||
// 启用快捷面板
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableQuickPanel"), appearance.IsShowQuickPanel);
|
||||
|
||||
// 退出折叠模式后自动进入批注模式
|
||||
if (MainWindow.Settings.Automation != null)
|
||||
{
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAutoEnterAnnotationModeWhenExitFoldMode"), MainWindow.Settings.Automation.IsAutoEnterAnnotationModeWhenExitFoldMode);
|
||||
}
|
||||
|
||||
// PPT放映结束后自动折叠
|
||||
if (MainWindow.Settings.Automation != null)
|
||||
{
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAutoFoldAfterPPTSlideShow"), MainWindow.Settings.Automation.IsAutoFoldAfterPPTSlideShow);
|
||||
}
|
||||
|
||||
// 退出白板模式后自动折叠
|
||||
if (MainWindow.Settings.Automation != null)
|
||||
{
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAutoFoldWhenExitWhiteboard"), MainWindow.Settings.Automation.IsAutoFoldWhenExitWhiteboard);
|
||||
}
|
||||
|
||||
// 信仰の源出自Where?
|
||||
SetOptionButtonState("ChickenSoupSource", appearance.ChickenSoupSource);
|
||||
|
||||
// 取消收纳按钮图标
|
||||
SetOptionButtonState("UnFoldBtnImg", appearance.UnFoldButtonImageType);
|
||||
|
||||
// 快捷调色盘显示模式
|
||||
SetOptionButtonState("QuickColorPaletteDisplayMode", appearance.QuickColorPaletteDisplayMode);
|
||||
|
||||
// 橡皮按钮显示
|
||||
SetOptionButtonState("EraserDisplayOption", appearance.EraserDisplayOption);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"加载个性化设置时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"加载个性化设置时出�? {ex.Message}");
|
||||
}
|
||||
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找ToggleSwitch控件
|
||||
/// </summary>
|
||||
private Border FindToggleSwitch(string name)
|
||||
{
|
||||
return this.FindDescendantByName(name) as Border;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置ToggleSwitch状态
|
||||
/// </summary>
|
||||
private void SetToggleSwitchState(Border toggleSwitch, bool isOn)
|
||||
{
|
||||
if (toggleSwitch == null) return;
|
||||
toggleSwitch.Background = isOn
|
||||
? new SolidColorBrush(Color.FromRgb(53, 132, 228))
|
||||
: ThemeHelper.GetButtonBackgroundBrush();
|
||||
? ThemeHelper.GetToggleSwitchOnBackgroundBrush()
|
||||
: ThemeHelper.GetToggleSwitchOffBackgroundBrush();
|
||||
var innerBorder = toggleSwitch.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
@@ -238,9 +195,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ToggleSwitch点击事件处理
|
||||
/// </summary>
|
||||
private void ToggleSwitch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
@@ -248,7 +202,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
bool isOn = border.Background.ToString() == "#FF3584E4";
|
||||
bool isOn = ThemeHelper.IsToggleSwitchOn(border.Background);
|
||||
bool newState = !isOn;
|
||||
SetToggleSwitchState(border, newState);
|
||||
|
||||
@@ -261,9 +215,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
switch (tag)
|
||||
{
|
||||
case "EnableSplashScreen":
|
||||
// 调用 MainWindow 中的方法(带主题检查)
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggledWithThemeCheck("ToggleSwitchEnableSplashScreen", newState);
|
||||
// 更新UI状态
|
||||
if (SplashScreenStylePanel != null)
|
||||
{
|
||||
SplashScreenStylePanel.Visibility = newState ? Visibility.Visible : Visibility.Collapsed;
|
||||
@@ -271,14 +223,11 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
break;
|
||||
|
||||
case "EnableDisPlayNibModeToggle":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableDisPlayNibModeToggle", newState);
|
||||
break;
|
||||
|
||||
case "EnableTrayIcon":
|
||||
// 调用 MainWindow 中的方法(带主题检查)
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggledWithThemeCheck("ToggleSwitchEnableTrayIcon", newState);
|
||||
// 更新系统托盘图标可见性
|
||||
var taskbar = Application.Current.Resources["TaskbarTrayIcon"] as TaskbarIcon;
|
||||
if (taskbar != null)
|
||||
{
|
||||
@@ -287,51 +236,40 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
break;
|
||||
|
||||
case "EnableViewboxBlackBoardScaleTransform":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableViewboxBlackBoardScaleTransform", newState);
|
||||
break;
|
||||
|
||||
case "EnableTimeDisplayInWhiteboardMode":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableTimeDisplayInWhiteboardMode", newState);
|
||||
break;
|
||||
|
||||
case "EnableChickenSoupInWhiteboardMode":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableChickenSoupInWhiteboardMode", newState);
|
||||
break;
|
||||
|
||||
case "EnableQuickPanel":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableQuickPanel", newState);
|
||||
break;
|
||||
|
||||
case "AutoEnterAnnotationModeWhenExitFoldMode":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAutoEnterAnnotationModeWhenExitFoldMode", newState);
|
||||
break;
|
||||
|
||||
case "AutoFoldAfterPPTSlideShow":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAutoFoldAfterPPTSlideShow", newState);
|
||||
break;
|
||||
|
||||
case "AutoFoldWhenExitWhiteboard":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAutoFoldWhenExitWhiteboard", newState);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ComboBox选择变化事件处理
|
||||
/// </summary>
|
||||
private void ComboBoxSplashScreenStyle_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
if (ComboBoxSplashScreenStyle?.SelectedIndex >= 0)
|
||||
{
|
||||
// 调用 MainWindow 中的方法(带主题检查)
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChangedWithThemeCheck("ComboBoxSplashScreenStyle", ComboBoxSplashScreenStyle.SelectedItem);
|
||||
}
|
||||
}
|
||||
@@ -341,14 +279,10 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
if (!_isLoaded) return;
|
||||
if (ComboBoxFloatingBarImg?.SelectedIndex >= 0)
|
||||
{
|
||||
// 调用 MainWindow 中的方法(带主题检查)
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChangedWithThemeCheck("ComboBoxFloatingBarImg", ComboBoxFloatingBarImg.SelectedItem);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Slider值变化事件处理
|
||||
/// </summary>
|
||||
private void ViewboxFloatingBarScaleTransformValueSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
@@ -356,7 +290,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
double val = ViewboxFloatingBarScaleTransformValueSlider.Value;
|
||||
ViewboxFloatingBarScaleTransformValueText.Text = val.ToString("F2");
|
||||
// 调用 MainWindow 中的方法(会自动检查主题更新)
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("ViewboxFloatingBarScaleTransformValueSlider", val);
|
||||
}
|
||||
}
|
||||
@@ -368,7 +301,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
double val = ViewboxFloatingBarOpacityValueSlider.Value;
|
||||
ViewboxFloatingBarOpacityValueText.Text = val.ToString("F2");
|
||||
// 调用 MainWindow 中的方法(会自动检查主题更新)
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("ViewboxFloatingBarOpacityValueSlider", val);
|
||||
}
|
||||
}
|
||||
@@ -380,14 +312,10 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
double val = ViewboxFloatingBarOpacityInPPTValueSlider.Value;
|
||||
ViewboxFloatingBarOpacityInPPTValueText.Text = val.ToString("F2");
|
||||
// 调用 MainWindow 中的方法(会自动检查主题更新)
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("ViewboxFloatingBarOpacityInPPTValueSlider", val);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// CheckBox变化事件处理
|
||||
/// </summary>
|
||||
private void CheckBox_CheckedChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
@@ -402,60 +330,47 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
switch (name)
|
||||
{
|
||||
case "CheckBoxUseLegacyFloatingBarUI":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeCheckBoxCheckedChanged("CheckBoxUseLegacyFloatingBarUI", checkBox.IsChecked ?? false);
|
||||
break;
|
||||
|
||||
case "CheckBoxShowShapeButton":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeCheckBoxCheckedChanged("CheckBoxShowShapeButton", checkBox.IsChecked ?? false);
|
||||
break;
|
||||
|
||||
case "CheckBoxShowUndoButton":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeCheckBoxCheckedChanged("CheckBoxShowUndoButton", checkBox.IsChecked ?? false);
|
||||
break;
|
||||
|
||||
case "CheckBoxShowRedoButton":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeCheckBoxCheckedChanged("CheckBoxShowRedoButton", checkBox.IsChecked ?? false);
|
||||
break;
|
||||
|
||||
case "CheckBoxShowClearButton":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeCheckBoxCheckedChanged("CheckBoxShowClearButton", checkBox.IsChecked ?? false);
|
||||
break;
|
||||
|
||||
case "CheckBoxShowWhiteboardButton":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeCheckBoxCheckedChanged("CheckBoxShowWhiteboardButton", checkBox.IsChecked ?? false);
|
||||
break;
|
||||
|
||||
case "CheckBoxShowHideButton":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeCheckBoxCheckedChanged("CheckBoxShowHideButton", checkBox.IsChecked ?? false);
|
||||
break;
|
||||
|
||||
case "CheckBoxShowQuickColorPalette":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeCheckBoxCheckedChanged("CheckBoxShowQuickColorPalette", checkBox.IsChecked ?? false);
|
||||
break;
|
||||
|
||||
case "CheckBoxShowLassoSelectButton":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeCheckBoxCheckedChanged("CheckBoxShowLassoSelectButton", checkBox.IsChecked ?? false);
|
||||
break;
|
||||
|
||||
case "CheckBoxShowClearAndMouseButton":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeCheckBoxCheckedChanged("CheckBoxShowClearAndMouseButton", checkBox.IsChecked ?? false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置选项按钮状态
|
||||
/// </summary>
|
||||
private void SetOptionButtonState(string group, int selectedIndex)
|
||||
{
|
||||
var buttons = new Dictionary<string, string[]>
|
||||
@@ -476,31 +391,11 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
var button = this.FindDescendantByName($"{group}{buttonNames[i]}Border") as Border;
|
||||
if (button != null)
|
||||
{
|
||||
if (i == selectedIndex)
|
||||
{
|
||||
button.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var textBlock = button.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Bold;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
button.Background = new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = button.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
}
|
||||
ThemeHelper.SetOptionButtonSelectedState(button, i == selectedIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选项按钮点击事件处理
|
||||
/// </summary>
|
||||
private void OptionButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
@@ -517,7 +412,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
string group = parts[0];
|
||||
string value = parts[1];
|
||||
|
||||
// 清除同组其他按钮的选中状态
|
||||
var parent = border.Parent as Panel;
|
||||
if (parent != null)
|
||||
{
|
||||
@@ -528,24 +422,13 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
string childTag = childBorder.Tag?.ToString();
|
||||
if (!string.IsNullOrEmpty(childTag) && childTag.StartsWith(group + "_"))
|
||||
{
|
||||
childBorder.Background = new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = childBorder.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
ThemeHelper.SetOptionButtonSelectedState(childBorder, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 设置当前按钮为选中状态
|
||||
border.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var currentTextBlock = border.Child as TextBlock;
|
||||
if (currentTextBlock != null)
|
||||
{
|
||||
currentTextBlock.FontWeight = FontWeights.Bold;
|
||||
}
|
||||
ThemeHelper.SetOptionButtonSelectedState(border, true);
|
||||
|
||||
var appearance = MainWindow.Settings.Appearance;
|
||||
if (appearance == null) return;
|
||||
@@ -553,7 +436,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
switch (group)
|
||||
{
|
||||
case "Theme":
|
||||
// 通过 MainWindowSettingsHelper 调用 ComboBoxTheme 的 SelectionChanged 事件处理器
|
||||
try
|
||||
{
|
||||
var mainWindow = Application.Current.MainWindow as MainWindow;
|
||||
@@ -562,7 +444,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
var comboBox = mainWindow.FindName("ComboBoxTheme") as System.Windows.Controls.ComboBox;
|
||||
if (comboBox != null)
|
||||
{
|
||||
// 根据 value 找到对应的 ComboBoxItem
|
||||
int themeIndex;
|
||||
switch (value)
|
||||
{
|
||||
@@ -587,20 +468,17 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置并通知主题更新
|
||||
MainWindowSettingsHelper.UpdateSettingSafely(() =>
|
||||
{
|
||||
appearance.Theme = themeIndex;
|
||||
}, "ComboBoxTheme_SelectionChanged", "ComboBoxTheme");
|
||||
MainWindowSettingsHelper.NotifyThemeUpdateIfNeeded("ComboBoxTheme");
|
||||
|
||||
// 触发主题变化事件,通知设置窗口更新主题
|
||||
ThemeChanged?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置并通知主题更新
|
||||
int themeIndex;
|
||||
switch (value)
|
||||
{
|
||||
@@ -623,14 +501,13 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}, "ComboBoxTheme_SelectionChanged", "ComboBoxTheme");
|
||||
MainWindowSettingsHelper.NotifyThemeUpdateIfNeeded("ComboBoxTheme");
|
||||
|
||||
// 触发主题变化事件,通知设置窗口更新主题
|
||||
ThemeChanged?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"切换主题时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"切换主题时出�? {ex.Message}");
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -654,7 +531,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
sourceIndex = 3;
|
||||
break;
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
var mainWindow6 = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow6 != null)
|
||||
{
|
||||
@@ -666,7 +542,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
appearance.ChickenSoupSource = sourceIndex;
|
||||
@@ -689,7 +564,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
imgType = 0;
|
||||
break;
|
||||
}
|
||||
// 调用 MainWindow 中的方法(带主题检查)
|
||||
var mainWindow3 = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow3 != null)
|
||||
{
|
||||
@@ -701,7 +575,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置并通知主题更新
|
||||
MainWindowSettingsHelper.UpdateSettingSafely(() =>
|
||||
{
|
||||
appearance.UnFoldButtonImageType = imgType;
|
||||
@@ -725,7 +598,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
displayMode = 1;
|
||||
break;
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
var mainWindow4 = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow4 != null)
|
||||
{
|
||||
@@ -737,7 +609,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
appearance.QuickColorPaletteDisplayMode = displayMode;
|
||||
@@ -766,7 +637,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
eraserOption = 0;
|
||||
break;
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
var mainWindow5 = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow5 != null)
|
||||
{
|
||||
@@ -778,7 +648,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
appearance.EraserDisplayOption = eraserOption;
|
||||
@@ -789,46 +658,42 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
if (MainWindow.Settings?.Appearance != null)
|
||||
{
|
||||
var appearance = MainWindow.Settings.Appearance;
|
||||
SetOptionButtonState("Theme", appearance.Theme);
|
||||
SetOptionButtonState("ChickenSoupSource", appearance.ChickenSoupSource);
|
||||
SetOptionButtonState("UnFoldBtnImg", appearance.UnFoldButtonImageType);
|
||||
SetOptionButtonState("QuickColorPaletteDisplayMode", appearance.QuickColorPaletteDisplayMode);
|
||||
SetOptionButtonState("EraserDisplayOption", appearance.EraserDisplayOption);
|
||||
}
|
||||
|
||||
// 为所有 ComboBox 添加 DropDownOpened 事件处理,以便在下拉菜单打开时更新颜色
|
||||
UpdateComboBoxDropdownTheme(ComboBoxSplashScreenStyle);
|
||||
UpdateComboBoxDropdownTheme(ComboBoxFloatingBarImg);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"ThemePanel 应用主题时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"ThemePanel 应用主题时出�? {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为 ComboBox 添加下拉菜单主题更新
|
||||
/// </summary>
|
||||
private void UpdateComboBoxDropdownTheme(System.Windows.Controls.ComboBox comboBox)
|
||||
{
|
||||
if (comboBox == null) return;
|
||||
|
||||
// 移除旧的事件处理(如果存在)
|
||||
comboBox.DropDownOpened -= ComboBox_DropDownOpened;
|
||||
// 添加新的事件处理
|
||||
comboBox.DropDownOpened += ComboBox_DropDownOpened;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ComboBox 下拉菜单打开事件处理
|
||||
/// </summary>
|
||||
private void ComboBox_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
if (sender is System.Windows.Controls.ComboBox comboBox)
|
||||
{
|
||||
// 延迟更新,确保 Popup 已经完全创建
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
ThemeHelper.UpdateComboBoxDropdownColors(comboBox);
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="950" d:DesignWidth="640">
|
||||
<UserControl.Resources>
|
||||
<!-- 开关样式模板 -->
|
||||
<Style x:Key="ToggleSwitchStyle" TargetType="Border">
|
||||
<Setter Property="Width" Value="48"/>
|
||||
<Setter Property="Height" Value="25"/>
|
||||
@@ -22,7 +21,6 @@
|
||||
</UserControl.Resources>
|
||||
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="ScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
|
||||
<StackPanel Margin="60,12,60,24">
|
||||
<!-- 计时器UI设置 -->
|
||||
<Border BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="计时器UI设置" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
@@ -31,8 +29,8 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="使用老版计时器按钮UI" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="使用旧版本的计时器按钮界面" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchUseLegacyTimerUI" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchUseLegacyTimerUI" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="UseLegacyTimerUI" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -45,8 +43,8 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="新计时器UI" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="使用新样式的计时器界面" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchUseNewStyleUI" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchUseNewStyleUI" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="UseNewStyleUI" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -59,8 +57,8 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启用正计时" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="计时器超时后继续正向计时" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableOvertimeCountUp" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchEnableOvertimeCountUp" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="EnableOvertimeCountUp" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -73,8 +71,8 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="超时醒目数字" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="计时器超时后数字显示为红色" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableOvertimeRedText" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchEnableOvertimeRedText" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnableOvertimeRedText" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
@@ -84,7 +82,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 提醒设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="提醒设置" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
@@ -110,8 +107,8 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="渐进提醒" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="启用渐进式提醒功能" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableProgressiveReminder" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border x:Name="ToggleSwitchEnableProgressiveReminder" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="EnableProgressiveReminder" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsHitTestVisible="False">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Ink_Canvas;
|
||||
using Ink_Canvas;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using System;
|
||||
using System.Windows;
|
||||
@@ -6,9 +6,6 @@ using System.Windows.Controls;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
/// <summary>
|
||||
/// TimerPanel.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class TimerPanel : UserControl
|
||||
{
|
||||
private bool _isLoaded = false;
|
||||
@@ -22,16 +19,10 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
private void TimerPanel_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LoadSettings();
|
||||
// 添加触摸支持
|
||||
MainWindowSettingsHelper.EnableTouchSupportForControls(this);
|
||||
// 应用主题
|
||||
ApplyTheme();
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载设置
|
||||
/// </summary>
|
||||
public void LoadSettings()
|
||||
{
|
||||
if (MainWindow.Settings == null || MainWindow.Settings.RandSettings == null) return;
|
||||
@@ -41,8 +32,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
try
|
||||
{
|
||||
var randSettings = MainWindow.Settings.RandSettings;
|
||||
|
||||
// 定时器音量
|
||||
if (TimerVolumeSlider != null)
|
||||
{
|
||||
TimerVolumeSlider.Value = randSettings.TimerVolume;
|
||||
@@ -51,23 +40,11 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
TimerVolumeText.Text = (randSettings.TimerVolume * 100).ToString("F0") + "%";
|
||||
}
|
||||
}
|
||||
|
||||
// 渐进提醒
|
||||
var toggleSwitchEnableProgressiveReminder = this.FindDescendantByName("ToggleSwitchEnableProgressiveReminder") as Border;
|
||||
if (toggleSwitchEnableProgressiveReminder != null)
|
||||
{
|
||||
bool isOn = randSettings.EnableProgressiveReminder;
|
||||
toggleSwitchEnableProgressiveReminder.Background = isOn
|
||||
? new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(53, 132, 228))
|
||||
: ThemeHelper.GetButtonBackgroundBrush();
|
||||
var innerBorder = toggleSwitchEnableProgressiveReminder.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
innerBorder.HorizontalAlignment = isOn ? HorizontalAlignment.Right : HorizontalAlignment.Left;
|
||||
}
|
||||
}
|
||||
|
||||
// 渐进提醒音量面板可见性
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchUseLegacyTimerUI"), randSettings.UseLegacyTimerUI);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchUseNewStyleUI"), randSettings.UseNewStyleUI);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableOvertimeCountUp"), randSettings.EnableOvertimeCountUp);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableOvertimeRedText"), randSettings.EnableOvertimeRedText);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableProgressiveReminder"), randSettings.EnableProgressiveReminder);
|
||||
var progressiveReminderVolumePanel = this.FindDescendantByName("ProgressiveReminderVolumePanel") as Grid;
|
||||
if (progressiveReminderVolumePanel != null)
|
||||
{
|
||||
@@ -75,8 +52,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
? Visibility.Visible
|
||||
: Visibility.Collapsed;
|
||||
}
|
||||
|
||||
// 渐进提醒音量
|
||||
if (ProgressiveReminderVolumeSlider != null)
|
||||
{
|
||||
ProgressiveReminderVolumeSlider.Value = randSettings.ProgressiveReminderVolume;
|
||||
@@ -109,10 +84,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
@@ -121,13 +92,9 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"TimerPanel 应用主题时出错: {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"TimerPanel 应用主题时出�? {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Slider值变化事件处理
|
||||
/// </summary>
|
||||
private void TimerVolumeSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
@@ -149,6 +116,68 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("ProgressiveReminderVolumeSlider", val);
|
||||
}
|
||||
}
|
||||
private Border FindToggleSwitch(string name)
|
||||
{
|
||||
return this.FindDescendantByName(name) as Border;
|
||||
}
|
||||
private void SetToggleSwitchState(Border toggleSwitch, bool isOn)
|
||||
{
|
||||
if (toggleSwitch == null) return;
|
||||
toggleSwitch.Background = isOn
|
||||
? ThemeHelper.GetToggleSwitchOnBackgroundBrush()
|
||||
: ThemeHelper.GetToggleSwitchOffBackgroundBrush();
|
||||
var innerBorder = toggleSwitch.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
innerBorder.HorizontalAlignment = isOn ? HorizontalAlignment.Right : HorizontalAlignment.Left;
|
||||
}
|
||||
}
|
||||
private void ToggleSwitch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
e.Handled = true;
|
||||
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
bool isOn = ThemeHelper.IsToggleSwitchOn(border.Background);
|
||||
bool newState = !isOn;
|
||||
SetToggleSwitchState(border, newState);
|
||||
|
||||
string tag = border.Tag?.ToString();
|
||||
if (string.IsNullOrEmpty(tag)) return;
|
||||
|
||||
switch (tag)
|
||||
{
|
||||
case "UseLegacyTimerUI":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchUseLegacyTimerUI", newState);
|
||||
break;
|
||||
|
||||
case "UseNewStyleUI":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchUseNewStyleUI", newState);
|
||||
break;
|
||||
|
||||
case "EnableOvertimeCountUp":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableOvertimeCountUp", newState);
|
||||
break;
|
||||
|
||||
case "EnableOvertimeRedText":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableOvertimeRedText", newState);
|
||||
break;
|
||||
|
||||
case "EnableProgressiveReminder":
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableProgressiveReminder", newState);
|
||||
if (ProgressiveReminderVolumePanel != null)
|
||||
{
|
||||
ProgressiveReminderVolumePanel.Visibility = newState ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
if (ProgressiveReminderSoundPanel != null)
|
||||
{
|
||||
ProgressiveReminderSoundPanel.Visibility = newState ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -206,7 +206,6 @@
|
||||
<DrawingImage x:Key="ShortcutsIcon">
|
||||
<DrawingImage.Drawing>
|
||||
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
|
||||
<!-- 键盘外框 -->
|
||||
<GeometryDrawing Brush="Transparent">
|
||||
<GeometryDrawing.Geometry>
|
||||
<PathGeometry Figures="M2,8 C2,7.46957 2.21071,6.96086 2.58579,6.58579 C2.96086,6.21071 3.46957,6 4,6 L20,6 C20.5304,6 21.0391,6.21071 21.4142,6.58579 C21.7893,6.96086 22,7.46957 22,8 L22,16 C22,16.5304 21.7893,17.0391 21.4142,17.4142 C21.0391,17.7893 20.5304,18 20,18 L4,18 C3.46957,18 2.96086,17.7893 2.58579,17.4142 C2.21071,17.0391 2,16.5304 2,16 L2,8 Z" />
|
||||
@@ -215,7 +214,6 @@
|
||||
<Pen Brush="#FF222222" Thickness="2" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" />
|
||||
</GeometryDrawing.Pen>
|
||||
</GeometryDrawing>
|
||||
<!-- 第一行按键点 -->
|
||||
<GeometryDrawing>
|
||||
<GeometryDrawing.Geometry>
|
||||
<PathGeometry Figures="M6,10 L6,10.01" />
|
||||
@@ -248,7 +246,6 @@
|
||||
<Pen Brush="#FF222222" Thickness="2" StartLineCap="Round" EndLineCap="Round" />
|
||||
</GeometryDrawing.Pen>
|
||||
</GeometryDrawing>
|
||||
<!-- 第二行按键 -->
|
||||
<GeometryDrawing>
|
||||
<GeometryDrawing.Geometry>
|
||||
<PathGeometry Figures="M6,14 L6,14.01" />
|
||||
@@ -265,7 +262,6 @@
|
||||
<Pen Brush="#FF222222" Thickness="2" StartLineCap="Round" EndLineCap="Round" />
|
||||
</GeometryDrawing.Pen>
|
||||
</GeometryDrawing>
|
||||
<!-- 中间长按键 -->
|
||||
<GeometryDrawing>
|
||||
<GeometryDrawing.Geometry>
|
||||
<PathGeometry Figures="M10,14 L14,14" />
|
||||
@@ -620,7 +616,6 @@
|
||||
<Grid>
|
||||
<Border x:Name="MainBorder" Background="#fafafa" CornerRadius="7" BorderBrush="#3584e4" BorderThickness="2" Margin="8">
|
||||
<Grid>
|
||||
<!--Sidebar-->
|
||||
<Border x:Name="SidebarBorder" Width="250" Background="#ebebeb" BorderBrush="#e1e1e1" CornerRadius="7,0,0,7" BorderThickness="0,0,2,0" HorizontalAlignment="Left">
|
||||
<Grid>
|
||||
<Grid Height="48" VerticalAlignment="Top">
|
||||
@@ -742,81 +737,60 @@
|
||||
</ItemsControl>
|
||||
</Grid>
|
||||
</Border>
|
||||
<!--AboutPanel-->
|
||||
<Grid Margin="250,48,0,0" Visibility="Collapsed" Name="AboutPane">
|
||||
<settingsViews:AboutPanel x:Name="SettingsAboutPanel"/>
|
||||
</Grid>
|
||||
|
||||
<!--CanvasAndInkPanel-->
|
||||
<Grid Margin="250,48,0,0" Visibility="Visible" Name="CanvasAndInkPane">
|
||||
<settingsViews:CanvasAndInkPanel x:Name="CanvasAndInkPanel"/>
|
||||
</Grid>
|
||||
<!--GesturesPanel-->
|
||||
<Grid Margin="250,48,0,0" Visibility="Collapsed" Name="GesturesPane">
|
||||
<settingsViews:GesturesPanel x:Name="GesturesPanel"/>
|
||||
</Grid>
|
||||
<!--StartupPanel-->
|
||||
<Grid Margin="250,48,0,0" Visibility="Collapsed" Name="StartupPane">
|
||||
<settingsViews:StartupPanel x:Name="StartupPanel"/>
|
||||
</Grid>
|
||||
<!--AppearancePanel-->
|
||||
<Grid Margin="250,48,0,0" Visibility="Collapsed" Name="AppearancePane">
|
||||
<settingsViews:AppearancePanel x:Name="AppearancePanel"/>
|
||||
</Grid>
|
||||
<!--InkRecognitionPanel-->
|
||||
<Grid Margin="250,48,0,0" Visibility="Collapsed" Name="InkRecognitionPane">
|
||||
<settingsViews:InkRecognitionPanel x:Name="InkRecognitionPanel"/>
|
||||
</Grid>
|
||||
<!--AutomationPanel-->
|
||||
<Grid Margin="250,48,0,0" Visibility="Collapsed" Name="AutomationPane">
|
||||
<settingsViews:AutomationPanel x:Name="AutomationPanel"/>
|
||||
</Grid>
|
||||
<!--PowerPointPanel-->
|
||||
<Grid Margin="250,48,0,0" Visibility="Collapsed" Name="PowerPointPane">
|
||||
<settingsViews:PowerPointPanel x:Name="PowerPointPanel"/>
|
||||
</Grid>
|
||||
|
||||
<!--个性化设置面板-->
|
||||
<Grid Margin="250,48,0,0" Visibility="Collapsed" Name="ThemePane">
|
||||
<settingsViews:ThemePanel x:Name="ThemePanel"/>
|
||||
</Grid>
|
||||
|
||||
<!--快捷键设置面板-->
|
||||
<Grid Margin="250,48,0,0" Visibility="Collapsed" Name="ShortcutsPane">
|
||||
<settingsViews:ShortcutsPanel x:Name="ShortcutsPanel"/>
|
||||
</Grid>
|
||||
|
||||
<!--崩溃处理面板-->
|
||||
<Grid Margin="250,48,0,0" Visibility="Collapsed" Name="CrashActionPane">
|
||||
<settingsViews:CrashActionPanel x:Name="CrashActionPanel"/>
|
||||
</Grid>
|
||||
|
||||
<!--幸运随机面板-->
|
||||
<Grid Margin="250,48,0,0" Visibility="Collapsed" Name="LuckyRandomPane">
|
||||
<settingsViews:LuckyRandomPanel x:Name="LuckyRandomPanel"/>
|
||||
</Grid>
|
||||
|
||||
<!--存储面板-->
|
||||
<Grid Margin="250,48,0,0" Visibility="Collapsed" Name="StoragePane">
|
||||
<settingsViews:StoragePanel x:Name="StoragePanel"/>
|
||||
</Grid>
|
||||
|
||||
<!--截图面板-->
|
||||
<Grid Margin="250,48,0,0" Visibility="Collapsed" Name="SnapshotPane">
|
||||
<settingsViews:SnapshotPanel x:Name="SnapshotPanel"/>
|
||||
</Grid>
|
||||
|
||||
<!--高级面板-->
|
||||
<Grid Margin="250,48,0,0" Visibility="Collapsed" Name="AdvancedPane">
|
||||
<settingsViews:AdvancedPanel x:Name="AdvancedPanel"/>
|
||||
</Grid>
|
||||
|
||||
<!--SearchPanel-->
|
||||
<Grid Margin="0,0,0,0" Visibility="Collapsed" Name="SearchPane" ZIndex="1000">
|
||||
<settingsViews:SearchPanel x:Name="SearchPanelControl"/>
|
||||
</Grid>
|
||||
|
||||
<!--Topbar-->
|
||||
<Grid Height="48" VerticalAlignment="Top" Margin="250,0,0,0">
|
||||
<Border x:Name="TopBarBorder" Height="48" CornerRadius="0,6,0,0" Background="#fafafa">
|
||||
<Border.Clip>
|
||||
|
||||
@@ -135,9 +135,9 @@ namespace Ink_Canvas.Windows
|
||||
SidebarItems.Add(new SidebarItem()
|
||||
{
|
||||
Type = SidebarItemType.Item,
|
||||
Title = "存储空间",
|
||||
Name = "StorageItem",
|
||||
IconSource = FindResource("StorageIcon") as DrawingImage,
|
||||
Title = "高级选项",
|
||||
Name = "AdvancedItem",
|
||||
IconSource = FindResource("AdvancedIcon") as DrawingImage,
|
||||
Selected = false,
|
||||
});
|
||||
SidebarItems.Add(new SidebarItem()
|
||||
@@ -153,14 +153,6 @@ namespace Ink_Canvas.Windows
|
||||
Type = SidebarItemType.Separator
|
||||
});
|
||||
SidebarItems.Add(new SidebarItem()
|
||||
{
|
||||
Type = SidebarItemType.Item,
|
||||
Title = "高级选项",
|
||||
Name = "AdvancedItem",
|
||||
IconSource = FindResource("AdvancedIcon") as DrawingImage,
|
||||
Selected = false,
|
||||
});
|
||||
SidebarItems.Add(new SidebarItem()
|
||||
{
|
||||
Type = SidebarItemType.Item,
|
||||
Title = "关于 InkCanvasForClass",
|
||||
@@ -180,9 +172,8 @@ namespace Ink_Canvas.Windows
|
||||
AutomationPane,
|
||||
PowerPointPane,
|
||||
LuckyRandomPane,
|
||||
StoragePane,
|
||||
SnapshotPane,
|
||||
AdvancedPane
|
||||
AdvancedPane,
|
||||
SnapshotPane
|
||||
};
|
||||
|
||||
SettingsPaneScrollViewers = new ScrollViewer[] {
|
||||
@@ -197,9 +188,8 @@ namespace Ink_Canvas.Windows
|
||||
AutomationPanel.ScrollViewerEx,
|
||||
PowerPointPanel.ScrollViewerEx,
|
||||
LuckyRandomPanel.ScrollViewerEx,
|
||||
StoragePanel.ScrollViewerEx,
|
||||
SnapshotPanel.ScrollViewerEx,
|
||||
AdvancedPanel.ScrollViewerEx
|
||||
AdvancedPanel.ScrollViewerEx,
|
||||
SnapshotPanel.ScrollViewerEx
|
||||
};
|
||||
|
||||
SettingsPaneTitles = new string[] {
|
||||
@@ -231,9 +221,8 @@ namespace Ink_Canvas.Windows
|
||||
"AutomationItem",
|
||||
"PowerPointItem",
|
||||
"LuckyRandomItem",
|
||||
"StorageItem",
|
||||
"SnapshotItem",
|
||||
"AdvancedItem"
|
||||
"AdvancedItem",
|
||||
"SnapshotItem"
|
||||
};
|
||||
|
||||
SettingsAboutPanel.IsTopBarNeedShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0.25;
|
||||
@@ -267,8 +256,6 @@ namespace Ink_Canvas.Windows
|
||||
CrashActionPanel.IsTopBarNeedNoShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0;
|
||||
LuckyRandomPanel.IsTopBarNeedShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0.25;
|
||||
LuckyRandomPanel.IsTopBarNeedNoShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0;
|
||||
StoragePanel.IsTopBarNeedShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0.25;
|
||||
StoragePanel.IsTopBarNeedNoShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0;
|
||||
SnapshotPanel.IsTopBarNeedShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0.25;
|
||||
SnapshotPanel.IsTopBarNeedNoShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0;
|
||||
AdvancedPanel.IsTopBarNeedShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0.25;
|
||||
@@ -323,8 +310,8 @@ namespace Ink_Canvas.Windows
|
||||
{
|
||||
StartupPanel, CanvasAndInkPanel, GesturesPanel, InkRecognitionPanel,
|
||||
ThemePanel, ShortcutsPanel, CrashActionPanel, PowerPointPanel,
|
||||
AutomationPanel, LuckyRandomPanel, StoragePanel, SnapshotPanel,
|
||||
AdvancedPanel, SettingsAboutPanel, AppearancePanel, SearchPanelControl
|
||||
AutomationPanel, LuckyRandomPanel, AdvancedPanel, SnapshotPanel,
|
||||
SettingsAboutPanel, AppearancePanel, SearchPanelControl
|
||||
};
|
||||
|
||||
foreach (var panel in panels)
|
||||
@@ -380,14 +367,16 @@ namespace Ink_Canvas.Windows
|
||||
}
|
||||
if (SearchButtonBorder != null)
|
||||
{
|
||||
SearchButtonBorder.Background = ThemeHelper.GetButtonBackgroundBrush(); // Windows 系统按钮背景
|
||||
// 更新搜索按钮图标颜色
|
||||
SearchButtonBorder.Background = ThemeHelper.GetButtonBackgroundBrush();
|
||||
SearchButtonBorder.BorderBrush = new SolidColorBrush(Colors.Transparent);
|
||||
SearchButtonBorder.BorderThickness = new Thickness(0);
|
||||
UpdateButtonIconColor(SearchButtonBorder, true);
|
||||
}
|
||||
if (MenuButtonBorder != null)
|
||||
{
|
||||
MenuButtonBorder.Background = ThemeHelper.GetButtonBackgroundBrush(); // Windows 系统按钮背景
|
||||
// 更新菜单按钮图标颜色
|
||||
MenuButtonBorder.Background = ThemeHelper.GetButtonBackgroundBrush();
|
||||
MenuButtonBorder.BorderBrush = new SolidColorBrush(Colors.Transparent);
|
||||
MenuButtonBorder.BorderThickness = new Thickness(0);
|
||||
UpdateButtonIconColor(MenuButtonBorder, true);
|
||||
}
|
||||
if (TitleTextBlock != null)
|
||||
@@ -444,6 +433,9 @@ namespace Ink_Canvas.Windows
|
||||
}
|
||||
CollectionViewSource.GetDefaultView(SidebarItems).Refresh();
|
||||
|
||||
// 更新侧边栏项的鼠标反馈边框背景色
|
||||
UpdateSidebarItemMouseFeedbackBorders(true);
|
||||
|
||||
// 更新图标颜色
|
||||
UpdateIconColors(true);
|
||||
}
|
||||
@@ -462,14 +454,16 @@ namespace Ink_Canvas.Windows
|
||||
}
|
||||
if (SearchButtonBorder != null)
|
||||
{
|
||||
SearchButtonBorder.Background = new SolidColorBrush(Color.FromRgb(217, 217, 217));
|
||||
// 更新搜索按钮图标颜色
|
||||
SearchButtonBorder.Background = ThemeHelper.GetButtonBackgroundBrush();
|
||||
SearchButtonBorder.BorderBrush = new SolidColorBrush(Colors.Transparent);
|
||||
SearchButtonBorder.BorderThickness = new Thickness(0);
|
||||
UpdateButtonIconColor(SearchButtonBorder, false);
|
||||
}
|
||||
if (MenuButtonBorder != null)
|
||||
{
|
||||
MenuButtonBorder.Background = new SolidColorBrush(Color.FromRgb(217, 217, 217));
|
||||
// 更新菜单按钮图标颜色
|
||||
MenuButtonBorder.Background = ThemeHelper.GetButtonBackgroundBrush();
|
||||
MenuButtonBorder.BorderBrush = new SolidColorBrush(Colors.Transparent);
|
||||
MenuButtonBorder.BorderThickness = new Thickness(0);
|
||||
UpdateButtonIconColor(MenuButtonBorder, false);
|
||||
}
|
||||
if (TitleTextBlock != null)
|
||||
@@ -519,6 +513,9 @@ namespace Ink_Canvas.Windows
|
||||
}
|
||||
CollectionViewSource.GetDefaultView(SidebarItems).Refresh();
|
||||
|
||||
// 更新侧边栏项的鼠标反馈边框背景色
|
||||
UpdateSidebarItemMouseFeedbackBorders(false);
|
||||
|
||||
// 更新图标颜色
|
||||
UpdateIconColors(false);
|
||||
}
|
||||
@@ -644,17 +641,47 @@ namespace Ink_Canvas.Windows
|
||||
try
|
||||
{
|
||||
Color iconColor = isDarkTheme
|
||||
? Color.FromRgb(243, 243, 243) // 深色主题使用浅色图标 #F3F3F3
|
||||
: Color.FromRgb(34, 34, 34); // 浅色主题使用深色图标 #222222
|
||||
? Color.FromRgb(243, 243, 243)
|
||||
: Color.FromRgb(34, 34, 34);
|
||||
|
||||
foreach (var item in contextMenu.Items)
|
||||
{
|
||||
if (item is MenuItem menuItem)
|
||||
{
|
||||
// 更新文字颜色
|
||||
menuItem.Foreground = ThemeHelper.GetTextPrimaryBrush();
|
||||
|
||||
if (menuItem.Style == null)
|
||||
{
|
||||
var style = new Style(typeof(MenuItem));
|
||||
|
||||
var hoverTrigger = new Trigger { Property = MenuItem.IsHighlightedProperty, Value = true };
|
||||
hoverTrigger.Setters.Add(new Setter(MenuItem.BackgroundProperty, ThemeHelper.GetHoverBackgroundBrush()));
|
||||
hoverTrigger.Setters.Add(new Setter(MenuItem.ForegroundProperty, ThemeHelper.GetTextPrimaryBrush()));
|
||||
style.Triggers.Add(hoverTrigger);
|
||||
|
||||
menuItem.Style = style;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var trigger in menuItem.Style.Triggers)
|
||||
{
|
||||
if (trigger is Trigger t && t.Property == MenuItem.IsHighlightedProperty)
|
||||
{
|
||||
foreach (var setter in t.Setters)
|
||||
{
|
||||
if (setter is Setter s && s.Property == MenuItem.ForegroundProperty)
|
||||
{
|
||||
s.Value = ThemeHelper.GetTextPrimaryBrush();
|
||||
}
|
||||
if (setter is Setter s2 && s2.Property == MenuItem.BackgroundProperty)
|
||||
{
|
||||
s2.Value = ThemeHelper.GetHoverBackgroundBrush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 更新图标颜色
|
||||
if (menuItem.Icon is Image iconImage && iconImage.Source is DrawingImage drawingImage)
|
||||
{
|
||||
if (drawingImage.Drawing is DrawingGroup drawingGroup)
|
||||
@@ -766,9 +793,8 @@ namespace Ink_Canvas.Windows
|
||||
PowerPointPanel,
|
||||
AutomationPanel,
|
||||
LuckyRandomPanel,
|
||||
StoragePanel,
|
||||
SnapshotPanel,
|
||||
AdvancedPanel,
|
||||
SnapshotPanel,
|
||||
SettingsAboutPanel,
|
||||
AppearancePanel
|
||||
};
|
||||
@@ -888,9 +914,7 @@ namespace Ink_Canvas.Windows
|
||||
{
|
||||
if (Selected)
|
||||
{
|
||||
return _isDarkTheme
|
||||
? ThemeHelper.GetSelectedBackgroundBrush() // Windows 系统选中背景 #3E3E3E
|
||||
: new SolidColorBrush(Color.FromRgb(237, 237, 237));
|
||||
return ThemeHelper.GetSelectedBackgroundBrush();
|
||||
}
|
||||
return new SolidColorBrush(Colors.Transparent);
|
||||
}
|
||||
@@ -898,16 +922,12 @@ namespace Ink_Canvas.Windows
|
||||
|
||||
public SolidColorBrush _siForeground
|
||||
{
|
||||
get => _isDarkTheme
|
||||
? ThemeHelper.GetTextPrimaryBrush() // Windows 系统主文字颜色 #F3F3F3
|
||||
: new SolidColorBrush(Color.FromRgb(0, 0, 0));
|
||||
get => ThemeHelper.GetTextPrimaryBrush();
|
||||
}
|
||||
|
||||
public SolidColorBrush _spStroke
|
||||
{
|
||||
get => _isDarkTheme
|
||||
? ThemeHelper.GetSeparatorBrush() // Windows 系统分隔线 #3E3E3E
|
||||
: new SolidColorBrush(Color.FromRgb(237, 237, 237));
|
||||
get => ThemeHelper.GetSeparatorBrush();
|
||||
}
|
||||
|
||||
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
|
||||
@@ -960,9 +980,8 @@ namespace Ink_Canvas.Windows
|
||||
{ "AutomationItem", AutomationPanel },
|
||||
{ "PowerPointItem", PowerPointPanel },
|
||||
{ "LuckyRandomItem", LuckyRandomPanel },
|
||||
{ "StorageItem", StoragePanel },
|
||||
{ "SnapshotItem", SnapshotPanel },
|
||||
{ "AdvancedItem", AdvancedPanel },
|
||||
{ "SnapshotItem", SnapshotPanel },
|
||||
{ "AppearanceItem", AppearancePanel }
|
||||
};
|
||||
|
||||
@@ -978,9 +997,8 @@ namespace Ink_Canvas.Windows
|
||||
if (AutomationPane != null) AutomationPane.Visibility = _selectedSidebarItemName == "AutomationItem" ? Visibility.Visible : Visibility.Collapsed;
|
||||
if (PowerPointPane != null) PowerPointPane.Visibility = _selectedSidebarItemName == "PowerPointItem" ? Visibility.Visible : Visibility.Collapsed;
|
||||
if (LuckyRandomPane != null) LuckyRandomPane.Visibility = _selectedSidebarItemName == "LuckyRandomItem" ? Visibility.Visible : Visibility.Collapsed;
|
||||
if (StoragePane != null) StoragePane.Visibility = _selectedSidebarItemName == "StorageItem" ? Visibility.Visible : Visibility.Collapsed;
|
||||
if (SnapshotPane != null) SnapshotPane.Visibility = _selectedSidebarItemName == "SnapshotItem" ? 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 (panelMappings.ContainsKey(_selectedSidebarItemName))
|
||||
@@ -1131,6 +1149,36 @@ namespace Ink_Canvas.Windows
|
||||
_sidebarItemMouseDownBorder = null;
|
||||
}
|
||||
|
||||
private void UpdateSidebarItemMouseFeedbackBorders(bool isDarkTheme)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 遍历所有侧边栏项,更新 MouseFeedbackBorder 的背景色
|
||||
if (SidebarItemsControl != null)
|
||||
{
|
||||
foreach (var item in SidebarItemsControl.Items)
|
||||
{
|
||||
var container = SidebarItemsControl.ItemContainerGenerator.ContainerFromItem(item);
|
||||
if (container != null)
|
||||
{
|
||||
var border = container.FindDescendantByName("MouseFeedbackBorder") as Border;
|
||||
if (border != null)
|
||||
{
|
||||
// 使用主题相关的颜色作为鼠标反馈背景
|
||||
border.Background = isDarkTheme
|
||||
? new SolidColorBrush(Color.FromRgb(9, 9, 11)) // 深色主题的鼠标反馈颜色
|
||||
: new SolidColorBrush(Color.FromRgb(0, 0, 0)); // 浅色主题的鼠标反馈颜色(黑色半透明)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"更新侧边栏项鼠标反馈边框时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private void CloseButton_Click(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
Close();
|
||||
@@ -1252,25 +1300,33 @@ namespace Ink_Canvas.Windows
|
||||
private void ToggleSwitch_Click(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
var border = sender as Border;
|
||||
if (border != null)
|
||||
if (border == null) return;
|
||||
|
||||
// 使用 ThemeHelper 判断当前状态
|
||||
bool isOn = ThemeHelper.IsToggleSwitchOn(border.Background);
|
||||
bool newState = !isOn;
|
||||
|
||||
// 使用统一的设置方法
|
||||
SetToggleSwitchState(border, newState);
|
||||
|
||||
// 根据Tag处理不同的设置项
|
||||
string tag = border.Tag?.ToString();
|
||||
if (!string.IsNullOrEmpty(tag))
|
||||
{
|
||||
// 切换开关状态
|
||||
bool isOn = border.Background.ToString() == "#FF3584E4";
|
||||
border.Background = isOn ? new SolidColorBrush(Color.FromRgb(225, 225, 225)) : new SolidColorBrush(Color.FromRgb(53, 132, 228));
|
||||
HandleSettingChange(tag, newState);
|
||||
}
|
||||
}
|
||||
|
||||
// 切换内部圆点的位置
|
||||
var innerBorder = border.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
innerBorder.HorizontalAlignment = isOn ? HorizontalAlignment.Left : HorizontalAlignment.Right;
|
||||
}
|
||||
|
||||
// 根据Tag处理不同的设置项
|
||||
string tag = border.Tag?.ToString();
|
||||
if (!string.IsNullOrEmpty(tag))
|
||||
{
|
||||
HandleSettingChange(tag, !isOn);
|
||||
}
|
||||
private void SetToggleSwitchState(Border toggleSwitch, bool isOn)
|
||||
{
|
||||
if (toggleSwitch == null) return;
|
||||
toggleSwitch.Background = isOn
|
||||
? ThemeHelper.GetToggleSwitchOnBackgroundBrush()
|
||||
: ThemeHelper.GetToggleSwitchOffBackgroundBrush();
|
||||
var innerBorder = toggleSwitch.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
innerBorder.HorizontalAlignment = isOn ? HorizontalAlignment.Right : HorizontalAlignment.Left;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user