add:新设置
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using Ink_Canvas.Helpers;
|
||||
using Ink_Canvas.Windows;
|
||||
using Ink_Canvas.Windows.SettingsViews;
|
||||
using iNKORE.UI.WPF.Modern;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
@@ -2874,46 +2876,64 @@ namespace Ink_Canvas
|
||||
|
||||
private void BtnSettings_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (BorderSettings.Visibility == Visibility.Visible)
|
||||
if (isOpeningOrHidingSettingsPane) return;
|
||||
HideSubPanels();
|
||||
{
|
||||
HideSubPanels();
|
||||
var settingsWindow = new SettingsWindow();
|
||||
settingsWindow.Owner = this;
|
||||
settingsWindow.ShowDialog();
|
||||
}
|
||||
else
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 显示老设置面板
|
||||
/// </summary>
|
||||
public void ShowOldSettingsPanel()
|
||||
{
|
||||
if (isOpeningOrHidingSettingsPane) return;
|
||||
HideSubPanels();
|
||||
|
||||
// 关闭新设置窗口
|
||||
foreach (Window window in Application.Current.Windows)
|
||||
{
|
||||
BorderSettings.Visibility = Visibility.Visible;
|
||||
wasNoFocusModeBeforeSettings = Settings.Advanced.IsNoFocusMode;
|
||||
userChangedNoFocusModeInSettings = false; // 重置用户修改标志
|
||||
if (wasNoFocusModeBeforeSettings)
|
||||
if (window is SettingsWindow)
|
||||
{
|
||||
isTemporarilyDisablingNoFocusMode = true;
|
||||
ApplyNoFocusMode();
|
||||
window.Close();
|
||||
break;
|
||||
}
|
||||
|
||||
// 设置蒙版为可点击,并添加半透明背景
|
||||
}
|
||||
|
||||
// 显示老设置面板
|
||||
if (BorderSettings.Visibility != Visibility.Visible)
|
||||
{
|
||||
isOpeningOrHidingSettingsPane = true;
|
||||
BorderSettings.Visibility = Visibility.Visible;
|
||||
BorderSettingsMask.Visibility = Visibility.Visible;
|
||||
BorderSettingsMask.IsHitTestVisible = true;
|
||||
BorderSettingsMask.Background = new SolidColorBrush(Color.FromArgb(1, 0, 0, 0));
|
||||
SettingsPanelScrollViewer.ScrollToTop();
|
||||
BorderSettingsMask.Background = new SolidColorBrush(Color.FromArgb(128, 0, 0, 0));
|
||||
|
||||
// 设置初始位置
|
||||
BorderSettings.RenderTransform = new TranslateTransform(490, 0);
|
||||
|
||||
var sb = new Storyboard();
|
||||
|
||||
// 滑动动画
|
||||
var slideAnimation = new DoubleAnimation
|
||||
{
|
||||
From = BorderSettings.RenderTransform.Value.OffsetX - 490, // 滑动距离
|
||||
From = 490,
|
||||
To = 0,
|
||||
Duration = TimeSpan.FromSeconds(0.6),
|
||||
EasingFunction = new CubicEase { EasingMode = EasingMode.EaseOut }
|
||||
};
|
||||
Storyboard.SetTargetProperty(slideAnimation,
|
||||
new PropertyPath("(UIElement.RenderTransform).(TranslateTransform.X)"));
|
||||
|
||||
Storyboard.SetTarget(slideAnimation, BorderSettings);
|
||||
|
||||
sb.Children.Add(slideAnimation);
|
||||
|
||||
sb.Completed += (s, _) => { isOpeningOrHidingSettingsPane = false; };
|
||||
|
||||
BorderSettings.RenderTransform = new TranslateTransform();
|
||||
|
||||
isOpeningOrHidingSettingsPane = true;
|
||||
sb.Begin(BorderSettings);
|
||||
sb.Completed += (s, _) =>
|
||||
{
|
||||
isOpeningOrHidingSettingsPane = false;
|
||||
};
|
||||
|
||||
sb.Begin();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2750,7 +2750,7 @@ namespace Ink_Canvas
|
||||
Settings.Startup.IsFoldAtStartup = false;
|
||||
}
|
||||
|
||||
private void BtnResetToSuggestion_Click(object sender, RoutedEventArgs e)
|
||||
public void BtnResetToSuggestion_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -259,5 +259,20 @@ 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);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"AboutPanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<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="ToggleSwitchIsSpecialScreen" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -52,7 +52,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="调整触摸大小的倍数" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="TouchMultiplierSlider" Width="150" Minimum="0" Maximum="2" Value="0.3" TickFrequency="0.01" IsSnapToTickEnabled="True"/>
|
||||
<Slider x:Name="TouchMultiplierSlider" Width="150" Minimum="0" Maximum="2" Value="0.3" TickFrequency="0.01" IsSnapToTickEnabled="True" ValueChanged="TouchMultiplierSlider_ValueChanged"/>
|
||||
<TextBlock x:Name="TouchMultiplierText" Text="0.30" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
@@ -62,7 +62,7 @@
|
||||
<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="ToggleSwitchEraserBindTouchMultiplier" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
using Ink_Canvas;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using Application = System.Windows.Application;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
@@ -9,9 +14,41 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
/// </summary>
|
||||
public partial class AdvancedPanel : UserControl
|
||||
{
|
||||
private bool _isLoaded = false;
|
||||
|
||||
public AdvancedPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += AdvancedPanel_Loaded;
|
||||
}
|
||||
|
||||
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);
|
||||
}), System.Windows.Threading.DispatcherPriority.Loaded);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"AdvancedPanel 启用触摸支持时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<RoutedEventArgs> IsTopBarNeedShadowEffect;
|
||||
@@ -29,6 +66,442 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载设置到UI
|
||||
/// </summary>
|
||||
public void LoadSettings()
|
||||
{
|
||||
if (MainWindow.Settings == null || MainWindow.Settings.Advanced == null) return;
|
||||
|
||||
_isLoaded = false;
|
||||
|
||||
try
|
||||
{
|
||||
var advanced = MainWindow.Settings.Advanced;
|
||||
|
||||
// 特殊屏幕模式
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchIsSpecialScreen"), advanced.IsSpecialScreen);
|
||||
|
||||
// 触摸倍数
|
||||
if (TouchMultiplierSlider != null)
|
||||
{
|
||||
TouchMultiplierSlider.Value = advanced.TouchMultiplier;
|
||||
if (TouchMultiplierText != null)
|
||||
{
|
||||
TouchMultiplierText.Text = advanced.TouchMultiplier.ToString("F2");
|
||||
}
|
||||
}
|
||||
|
||||
// 橡皮擦绑定触摸大小倍数
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEraserBindTouchMultiplier"), advanced.EraserBindTouchMultiplier);
|
||||
|
||||
// 笔尖模式 BoundsWidth
|
||||
if (NibModeBoundsWidthSlider != null)
|
||||
{
|
||||
NibModeBoundsWidthSlider.Value = advanced.NibModeBoundsWidth;
|
||||
if (NibModeBoundsWidthText != null)
|
||||
{
|
||||
NibModeBoundsWidthText.Text = advanced.NibModeBoundsWidth.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
// 手指模式 BoundsWidth
|
||||
if (FingerModeBoundsWidthSlider != null)
|
||||
{
|
||||
FingerModeBoundsWidthSlider.Value = advanced.FingerModeBoundsWidth;
|
||||
if (FingerModeBoundsWidthText != null)
|
||||
{
|
||||
FingerModeBoundsWidthText.Text = advanced.FingerModeBoundsWidth.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
// 四边红外模式
|
||||
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);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchIsEnableForceFullScreen"), advanced.IsEnableForceFullScreen);
|
||||
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 类中,如果不在,需要调整
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
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))
|
||||
: new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var innerBorder = toggleSwitch.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
innerBorder.HorizontalAlignment = isOn ? HorizontalAlignment.Right : HorizontalAlignment.Left;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置选项按钮状态
|
||||
/// </summary>
|
||||
private void SetOptionButtonState(string group, int selectedValue)
|
||||
{
|
||||
var buttons = new Dictionary<string, Dictionary<int, string>>
|
||||
{
|
||||
{ "AutoBackupInterval", new Dictionary<int, string> { { 1, "1Day" }, { 3, "3Days" }, { 7, "7Days" }, { 14, "14Days" }, { 30, "30Days" } } }
|
||||
};
|
||||
|
||||
if (!buttons.ContainsKey(group)) return;
|
||||
|
||||
var buttonNames = buttons[group];
|
||||
if (!buttonNames.ContainsKey(selectedValue)) return;
|
||||
|
||||
string buttonName = buttonNames[selectedValue];
|
||||
var button = this.FindDescendantByName($"{group}{buttonName}Border") as Border;
|
||||
if (button != null)
|
||||
{
|
||||
// 清除同组其他按钮的选中状态
|
||||
var parent = button.Parent as Panel;
|
||||
if (parent != null)
|
||||
{
|
||||
foreach (var child in parent.Children)
|
||||
{
|
||||
if (child is Border childBorder && childBorder != button)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 设置当前按钮为选中状态
|
||||
button.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var currentTextBlock = button.Child as TextBlock;
|
||||
if (currentTextBlock != null)
|
||||
{
|
||||
currentTextBlock.FontWeight = FontWeights.Bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ToggleSwitch点击事件处理
|
||||
/// </summary>
|
||||
private void ToggleSwitch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
bool isOn = border.Background.ToString() == "#FF3584E4";
|
||||
bool newState = !isOn;
|
||||
SetToggleSwitchState(border, newState);
|
||||
|
||||
string tag = border.Tag?.ToString();
|
||||
if (string.IsNullOrEmpty(tag)) return;
|
||||
|
||||
var advanced = MainWindow.Settings.Advanced;
|
||||
if (advanced == null) return;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Slider值变化事件处理
|
||||
/// </summary>
|
||||
private void TouchMultiplierSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
if (TouchMultiplierSlider != null && TouchMultiplierText != null)
|
||||
{
|
||||
double value = TouchMultiplierSlider.Value;
|
||||
TouchMultiplierText.Text = value.ToString("F2");
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("TouchMultiplierSlider", value);
|
||||
}
|
||||
}
|
||||
|
||||
private void NibModeBoundsWidthSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
if (NibModeBoundsWidthSlider != null && NibModeBoundsWidthText != null)
|
||||
{
|
||||
double value = NibModeBoundsWidthSlider.Value;
|
||||
NibModeBoundsWidthText.Text = ((int)value).ToString();
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("NibModeBoundsWidthSlider", value);
|
||||
}
|
||||
}
|
||||
|
||||
private void FingerModeBoundsWidthSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
if (FingerModeBoundsWidthSlider != null && FingerModeBoundsWidthText != null)
|
||||
{
|
||||
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;
|
||||
|
||||
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 + "_"))
|
||||
{
|
||||
childBorder.Background = new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = childBorder.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 设置当前按钮为选中状态
|
||||
border.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var currentTextBlock = border.Child as TextBlock;
|
||||
if (currentTextBlock != null)
|
||||
{
|
||||
currentTextBlock.FontWeight = FontWeights.Bold;
|
||||
}
|
||||
|
||||
if (MainWindow.Settings.Advanced == null) return;
|
||||
|
||||
switch (group)
|
||||
{
|
||||
case "AutoBackupInterval":
|
||||
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)
|
||||
{
|
||||
comboBox.SelectedItem = item;
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChanged("ComboBoxAutoBackupInterval", item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
MainWindow.Settings.Advanced.AutoBackupIntervalDays = days;
|
||||
}, "ComboBoxAutoBackupInterval");
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <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 的检查文件关联方法
|
||||
break;
|
||||
|
||||
case "BtnRegisterFileAssociation":
|
||||
// TODO: 调用 MainWindow 的注册文件关联方法
|
||||
break;
|
||||
|
||||
case "BtnDlassSettingsManage":
|
||||
// TODO: 调用 MainWindow 的 Dlass 设置管理方法
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"AdvancedPanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,5 +29,20 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"AppearancePanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
<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">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -54,7 +54,7 @@
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<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">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -65,7 +65,7 @@
|
||||
<StackPanel Grid.Row="0" Grid.Column="2" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<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">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -76,7 +76,7 @@
|
||||
<StackPanel Grid.Row="0" Grid.Column="3" Orientation="Vertical" Margin="0,0,0,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="ToggleSwitchAutoFoldInEasiNote3" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -88,7 +88,7 @@
|
||||
<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">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -99,7 +99,7 @@
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" 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="ToggleSwitchAutoFoldInEasiNote5C" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -110,7 +110,7 @@
|
||||
<StackPanel Grid.Row="1" Grid.Column="2" 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="ToggleSwitchAutoFoldInSeewoPincoTeacher" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -121,7 +121,7 @@
|
||||
<StackPanel Grid.Row="1" Grid.Column="3" Orientation="Vertical" Margin="0,0,0,12">
|
||||
<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">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -133,7 +133,7 @@
|
||||
<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">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -144,7 +144,7 @@
|
||||
<StackPanel Grid.Row="2" Grid.Column="1" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<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">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -155,7 +155,7 @@
|
||||
<StackPanel Grid.Row="2" Grid.Column="2" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<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">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -166,7 +166,7 @@
|
||||
<StackPanel Grid.Row="2" Grid.Column="3" Orientation="Vertical" Margin="0,0,0,12">
|
||||
<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">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -178,7 +178,7 @@
|
||||
<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">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -189,7 +189,7 @@
|
||||
<StackPanel Grid.Row="3" Grid.Column="1" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<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">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -200,7 +200,7 @@
|
||||
<StackPanel Grid.Row="3" Grid.Column="2" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<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">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -211,7 +211,7 @@
|
||||
<StackPanel Grid.Row="3" Grid.Column="3" Orientation="Vertical" Margin="0,0,0,12">
|
||||
<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">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -226,7 +226,7 @@
|
||||
<Image Source="/Resources/Icons-png/Powerpoint.png" Margin="0,0,6,0" Width="28" Height="28" VerticalAlignment="Center"/>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="播放PPT时自动收纳" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInPPTSlideShow" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -240,7 +240,7 @@
|
||||
<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="ToggleSwitchKeepFoldAfterSoftwareExit" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -254,7 +254,7 @@
|
||||
<Image Source="/Resources/Icons-png/EasiNote.png" Margin="0,0,6,0" Width="28" Height="28" VerticalAlignment="Center"/>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="自动收纳忽略桌面EN5批注窗口" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInEasiNoteIgnoreDesktopAnno" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -268,7 +268,7 @@
|
||||
<Image Source="/Resources/Icons-png/Donview.png" Margin="0,0,6,0" Width="28" Height="28" VerticalAlignment="Center"/>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="进入"中原旧白板"时自动收纳" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInOldZyBoard" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Ink_Canvas.Windows.SettingsViews;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
@@ -9,9 +10,129 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
/// </summary>
|
||||
public partial class AutomationPanel : UserControl
|
||||
{
|
||||
private bool _isLoaded = false;
|
||||
|
||||
public AutomationPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += AutomationPanel_Loaded;
|
||||
}
|
||||
|
||||
private void AutomationPanel_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LoadSettings();
|
||||
// 添加触摸支持
|
||||
EnableTouchSupport();
|
||||
// 应用主题
|
||||
ApplyTheme();
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载设置
|
||||
/// </summary>
|
||||
private void LoadSettings()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (MainWindow.Settings == null || MainWindow.Settings.Automation == null) return;
|
||||
|
||||
_isLoaded = false;
|
||||
|
||||
var automation = MainWindow.Settings.Automation;
|
||||
|
||||
// 设置所有 ToggleSwitch 的状态
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInEasiNote", automation.IsAutoFoldInEasiNote);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInEasiCamera", automation.IsAutoFoldInEasiCamera);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInHiteTouchPro", automation.IsAutoFoldInHiteTouchPro);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInEasiNote3", automation.IsAutoFoldInEasiNote3);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInEasiNote3C", automation.IsAutoFoldInEasiNote3C);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInEasiNote5C", automation.IsAutoFoldInEasiNote5C);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInSeewoPincoTeacher", automation.IsAutoFoldInSeewoPincoTeacher);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInHiteCamera", automation.IsAutoFoldInHiteCamera);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInHiteLightBoard", automation.IsAutoFoldInHiteLightBoard);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInWxBoardMain", automation.IsAutoFoldInWxBoardMain);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInMSWhiteboard", automation.IsAutoFoldInMSWhiteboard);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInAdmoxWhiteboard", automation.IsAutoFoldInAdmoxWhiteboard);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInAdmoxBooth", automation.IsAutoFoldInAdmoxBooth);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInQPoint", automation.IsAutoFoldInQPoint);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInYiYunVisualPresenter", automation.IsAutoFoldInYiYunVisualPresenter);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInMaxHubWhiteboard", automation.IsAutoFoldInMaxHubWhiteboard);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInPPTSlideShow", automation.IsAutoFoldInPPTSlideShow);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInEasiNoteIgnoreDesktopAnno", automation.IsAutoFoldInEasiNoteIgnoreDesktopAnno);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInOldZyBoard", automation.IsAutoFoldInOldZyBoard);
|
||||
SetToggleSwitchState("ToggleSwitchKeepFoldAfterSoftwareExit", automation.KeepFoldAfterSoftwareExit);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"AutomationPanel 加载设置时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置 ToggleSwitch 状态
|
||||
/// </summary>
|
||||
private void SetToggleSwitchState(string name, bool isOn)
|
||||
{
|
||||
try
|
||||
{
|
||||
var border = FindName(name) as System.Windows.Controls.Border;
|
||||
if (border != null)
|
||||
{
|
||||
bool currentState = border.Background.ToString().Contains("3584e4");
|
||||
if (currentState != isOn)
|
||||
{
|
||||
border.Background = isOn ? new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(0x35, 0x84, 0xe4)) : new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(0xe1, 0xe1, 0xe1));
|
||||
var innerBorder = border.Child as System.Windows.Controls.Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
innerBorder.HorizontalAlignment = isOn ? HorizontalAlignment.Right : HorizontalAlignment.Left;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"AutomationPanel 设置 ToggleSwitch {name} 状态时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ToggleSwitch 点击事件处理
|
||||
/// </summary>
|
||||
private void ToggleSwitch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
var border = sender as System.Windows.Controls.Border;
|
||||
if (border == null) return;
|
||||
|
||||
bool currentState = border.Background.ToString().Contains("3584e4");
|
||||
bool newState = !currentState;
|
||||
SetToggleSwitchState(border.Name, newState);
|
||||
|
||||
// 通过 MainWindowSettingsHelper 调用 MainWindow 中的方法
|
||||
string toggleSwitchName = border.Name;
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled(toggleSwitchName, newState);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为面板中的所有交互控件启用触摸支持
|
||||
/// </summary>
|
||||
private void EnableTouchSupport()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 延迟执行,确保所有控件都已加载
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
MainWindowSettingsHelper.EnableTouchSupportForControls(this);
|
||||
}), System.Windows.Threading.DispatcherPriority.Loaded);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"AutomationPanel 启用触摸支持时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<RoutedEventArgs> IsTopBarNeedShadowEffect;
|
||||
@@ -29,6 +150,21 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"AutomationPanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<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="ToggleSwitchShowCursor" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -49,7 +49,7 @@
|
||||
<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="ToggleSwitchEnablePressureTouchMode" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -63,7 +63,7 @@
|
||||
<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="ToggleSwitchDisablePressure" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -77,19 +77,19 @@
|
||||
<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="EraserSizeVerySmall" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="EraserSize_VerySmall">
|
||||
<Border x:Name="EraserSizeVerySmall" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="EraserSize_VerySmall" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="很小"/>
|
||||
</Border>
|
||||
<Border x:Name="EraserSizeSmall" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="EraserSize_Small" Margin="8,0,0,0">
|
||||
<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">
|
||||
<Border x:Name="EraserSizeMedium" Padding="13,7" CornerRadius="8" Background="#e1e1e1" 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">
|
||||
<Border x:Name="EraserSizeLarge" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="EraserSize_Large" Margin="8,0,0,0" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="较大"/>
|
||||
</Border>
|
||||
<Border x:Name="EraserSizeVeryLarge" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="EraserSize_VeryLarge" Margin="8,0,0,0">
|
||||
<Border x:Name="EraserSizeVeryLarge" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="EraserSize_VeryLarge" Margin="8,0,0,0" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="很大"/>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
@@ -105,7 +105,7 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="退出画板模式后隐藏墨迹" HorizontalAlignment="Left"/>
|
||||
<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">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -119,7 +119,7 @@
|
||||
<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="ToggleSwitchClearCanvasAndClearTimeMachine" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -133,7 +133,7 @@
|
||||
<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="ToggleSwitchClearCanvasAlsoClearImages" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -147,7 +147,7 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="插入图片时自动压缩(大于1920x1080)" HorizontalAlignment="Left"/>
|
||||
<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">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -166,13 +166,13 @@
|
||||
<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">
|
||||
<Border x:Name="HyperbolaAsymptoteYes" Padding="13,7" CornerRadius="8" Background="#e1e1e1" 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">
|
||||
<Border x:Name="HyperbolaAsymptoteNo" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="HyperbolaAsymptote_No" Margin="8,0,0,0" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="否"/>
|
||||
</Border>
|
||||
<Border x:Name="HyperbolaAsymptoteAsk" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="HyperbolaAsymptote_Ask" Margin="8,0,0,0">
|
||||
<Border x:Name="HyperbolaAsymptoteAsk" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="HyperbolaAsymptote_Ask" Margin="8,0,0,0" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="每次询问"/>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
@@ -183,7 +183,7 @@
|
||||
<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="ToggleSwitchShowCircleCenter" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -197,7 +197,7 @@
|
||||
<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">
|
||||
<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">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -211,7 +211,7 @@
|
||||
<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="ToggleSwitchAdvancedBezierSmoothing" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -230,7 +230,7 @@
|
||||
<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="ToggleSwitchEnableInkFade" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1">
|
||||
<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">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -245,7 +245,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" 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"/>
|
||||
<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>
|
||||
@@ -261,7 +261,7 @@
|
||||
<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">
|
||||
<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"/>
|
||||
@@ -276,25 +276,25 @@
|
||||
<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">
|
||||
<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">
|
||||
<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">
|
||||
<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">
|
||||
<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">
|
||||
<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">
|
||||
<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">
|
||||
<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>
|
||||
@@ -309,7 +309,7 @@
|
||||
<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">
|
||||
<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"/>
|
||||
@@ -323,7 +323,7 @@
|
||||
<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">
|
||||
<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"/>
|
||||
@@ -341,7 +341,7 @@
|
||||
<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">
|
||||
<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"/>
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
using Ink_Canvas;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
@@ -13,9 +15,41 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
/// </summary>
|
||||
public partial class CanvasAndInkPanel : UserControl
|
||||
{
|
||||
private bool _isLoaded = false;
|
||||
|
||||
public CanvasAndInkPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += CanvasAndInkPanel_Loaded;
|
||||
}
|
||||
|
||||
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);
|
||||
}), System.Windows.Threading.DispatcherPriority.Loaded);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"CanvasAndInkPanel 启用触摸支持时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<RoutedEventArgs> IsTopBarNeedShadowEffect;
|
||||
@@ -33,6 +67,541 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载设置到UI
|
||||
/// </summary>
|
||||
public void LoadSettings()
|
||||
{
|
||||
if (MainWindow.Settings == null || MainWindow.Settings.Canvas == null) return;
|
||||
|
||||
_isLoaded = false;
|
||||
|
||||
try
|
||||
{
|
||||
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);
|
||||
|
||||
// 使用WPF默认贝塞尔曲线平滑
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchFitToCurve"), canvas.FitToCurve && !canvas.UseAdvancedBezierSmoothing);
|
||||
|
||||
// 使用高级贝塞尔曲线平滑
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAdvancedBezierSmoothing"), canvas.UseAdvancedBezierSmoothing);
|
||||
|
||||
// 启用异步墨迹平滑
|
||||
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);
|
||||
|
||||
// 启用墨迹渐隐功能
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableInkFade"), canvas.EnableInkFade);
|
||||
if (InkFadeTimePanel != null)
|
||||
{
|
||||
InkFadeTimePanel.Visibility = canvas.EnableInkFade ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
if (InkFadeTimeSlider != null)
|
||||
{
|
||||
InkFadeTimeSlider.Value = canvas.InkFadeTime;
|
||||
}
|
||||
|
||||
// 定时自动保存墨迹
|
||||
// 注意:这个设置可能在 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)
|
||||
{
|
||||
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))
|
||||
: new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var innerBorder = toggleSwitch.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
innerBorder.HorizontalAlignment = isOn ? HorizontalAlignment.Right : HorizontalAlignment.Left;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置选项按钮状态
|
||||
/// </summary>
|
||||
private void SetOptionButtonState(string group, int selectedIndex)
|
||||
{
|
||||
var buttons = new[] { "VerySmall", "Small", "Medium", "Large", "VeryLarge" };
|
||||
var hyperbolaButtons = new[] { "Yes", "No", "Ask" };
|
||||
|
||||
string[] buttonNames = group == "EraserSize" ? buttons : hyperbolaButtons;
|
||||
|
||||
for (int i = 0; i < buttonNames.Length && i <= selectedIndex; 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ToggleSwitch点击事件处理
|
||||
/// </summary>
|
||||
private void ToggleSwitch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
bool isOn = border.Background.ToString() == "#FF3584E4";
|
||||
bool newState = !isOn;
|
||||
SetToggleSwitchState(border, newState);
|
||||
|
||||
string tag = border.Tag?.ToString();
|
||||
if (string.IsNullOrEmpty(tag)) return;
|
||||
|
||||
var canvas = MainWindow.Settings.Canvas;
|
||||
if (canvas == null) return;
|
||||
|
||||
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);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchDisablePressure"), false);
|
||||
}
|
||||
break;
|
||||
|
||||
case "DisablePressure":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchDisablePressure", newState);
|
||||
// 处理互斥逻辑
|
||||
if (newState && canvas.EnablePressureTouchMode)
|
||||
{
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnablePressureTouchMode", false);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnablePressureTouchMode"), false);
|
||||
}
|
||||
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 "ShowCircleCenter":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchShowCircleCenter", newState);
|
||||
break;
|
||||
|
||||
case "FitToCurve":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchFitToCurve", newState);
|
||||
// 处理互斥逻辑
|
||||
if (newState)
|
||||
{
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAdvancedBezierSmoothing", false);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAdvancedBezierSmoothing"), false);
|
||||
}
|
||||
break;
|
||||
|
||||
case "AdvancedBezierSmoothing":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAdvancedBezierSmoothing", newState);
|
||||
// 处理互斥逻辑
|
||||
if (newState)
|
||||
{
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchFitToCurve", false);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchFitToCurve"), false);
|
||||
}
|
||||
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 "EnableInkFade":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableInkFade", newState);
|
||||
// 更新UI状态
|
||||
if (InkFadeTimePanel != null)
|
||||
{
|
||||
InkFadeTimePanel.Visibility = newState ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
break;
|
||||
|
||||
case "EnableAutoSaveStrokes":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableAutoSaveStrokes", newState);
|
||||
break;
|
||||
|
||||
case "SaveFullPageStrokes":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchSaveFullPageStrokes", newState);
|
||||
break;
|
||||
|
||||
case "SaveStrokesAsXML":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchSaveStrokesAsXML", newState);
|
||||
break;
|
||||
|
||||
case "AutoSaveStrokesInPowerPoint":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAutoSaveStrokesInPowerPoint", newState);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选项按钮点击事件处理
|
||||
/// </summary>
|
||||
private void OptionButton_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 + "_"))
|
||||
{
|
||||
childBorder.Background = new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = childBorder.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 设置当前按钮为选中状态
|
||||
border.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var currentTextBlock = border.Child as TextBlock;
|
||||
if (currentTextBlock != null)
|
||||
{
|
||||
currentTextBlock.FontWeight = FontWeights.Bold;
|
||||
}
|
||||
|
||||
var canvas = MainWindow.Settings.Canvas;
|
||||
if (canvas == null) return;
|
||||
|
||||
switch (group)
|
||||
{
|
||||
case "EraserSize":
|
||||
int eraserSize;
|
||||
switch (value)
|
||||
{
|
||||
case "VerySmall":
|
||||
eraserSize = 0;
|
||||
break;
|
||||
case "Small":
|
||||
eraserSize = 1;
|
||||
break;
|
||||
case "Medium":
|
||||
eraserSize = 2;
|
||||
break;
|
||||
case "Large":
|
||||
eraserSize = 3;
|
||||
break;
|
||||
case "VeryLarge":
|
||||
eraserSize = 4;
|
||||
break;
|
||||
default:
|
||||
eraserSize = 2;
|
||||
break;
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
var mainWindow = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow != null)
|
||||
{
|
||||
var comboBox = mainWindow.FindName("ComboBoxEraserSize") as System.Windows.Controls.ComboBox;
|
||||
if (comboBox != null && comboBox.Items.Count > eraserSize)
|
||||
{
|
||||
comboBox.SelectedIndex = eraserSize;
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChanged("ComboBoxEraserSize", comboBox.Items[eraserSize]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
canvas.EraserSize = eraserSize;
|
||||
}, "ComboBoxEraserSize");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "HyperbolaAsymptote":
|
||||
OptionalOperation option;
|
||||
switch (value)
|
||||
{
|
||||
case "Yes":
|
||||
option = OptionalOperation.Yes;
|
||||
break;
|
||||
case "No":
|
||||
option = OptionalOperation.No;
|
||||
break;
|
||||
case "Ask":
|
||||
option = OptionalOperation.Ask;
|
||||
break;
|
||||
default:
|
||||
option = OptionalOperation.Ask;
|
||||
break;
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
var mainWindow2 = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow2 != null)
|
||||
{
|
||||
var comboBox = mainWindow2.FindName("ComboBoxHyperbolaAsymptoteOption") as System.Windows.Controls.ComboBox;
|
||||
if (comboBox != null)
|
||||
{
|
||||
int optionIndex = (int)option;
|
||||
if (comboBox.Items.Count > optionIndex)
|
||||
{
|
||||
comboBox.SelectedIndex = optionIndex;
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChanged("ComboBoxHyperbolaAsymptoteOption", comboBox.Items[optionIndex]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
canvas.HyperbolaAsymptoteOption = option;
|
||||
}, "ComboBoxHyperbolaAsymptoteOption");
|
||||
}
|
||||
}
|
||||
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)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
OptionButton_Click(sender, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Slider值变化事件处理
|
||||
/// </summary>
|
||||
private void InkFadeTimeSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
if (InkFadeTimeSlider != null && InkFadeTimeText != null)
|
||||
{
|
||||
double value = InkFadeTimeSlider.Value;
|
||||
InkFadeTimeText.Text = $"{(int)value}ms";
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("InkFadeTimeSlider", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"CanvasAndInkPanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,21 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"CrashActionPanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using iNKORE.UI.WPF.DragDrop;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
@@ -143,5 +144,20 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IconSource = FindResource("PenIcon") as DrawingImage,
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"FloatingBarDnDSettingsPanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<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="ToggleSwitchAutoSwitchTwoFingerGesture" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -49,7 +49,7 @@
|
||||
<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="ToggleSwitchEnableTwoFingerRotationOnSelection" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -68,7 +68,7 @@
|
||||
<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="ToggleSwitchEnablePalmEraser" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1">
|
||||
<Border x:Name="ToggleSwitchEnablePalmEraser" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="EnablePalmEraser" 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"/>
|
||||
@@ -77,23 +77,23 @@
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54" x:Name="PalmEraserSensitivityPanel" 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"/>
|
||||
<StackPanel Orientation="Vertical" x:Name="PalmEraserSensitivityPanel" Visibility="Collapsed" Margin="0,12,0,12">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="手掌擦敏感度" HorizontalAlignment="Left" Margin="0,0,0,8"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,0,0,12" Text="低敏感度:需要更大的触摸面积和更多触摸点,减少误判;高敏感度:更容易触发手掌擦,但可能误判手指" HorizontalAlignment="Left" TextWrapping="Wrap"/>
|
||||
</StackPanel>
|
||||
<WrapPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Border x:Name="PalmEraserSensitivityLowBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="PalmEraserSensitivity_Low" Margin="0,0,8,8">
|
||||
<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">
|
||||
<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,8">
|
||||
<Border x:Name="PalmEraserSensitivityMediumBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="PalmEraserSensitivity_Medium" Margin="0,0,8,0" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="中敏感度"/>
|
||||
</Border>
|
||||
<Border x:Name="PalmEraserSensitivityHighBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="PalmEraserSensitivity_High" Margin="0,0,8,8">
|
||||
<Border x:Name="PalmEraserSensitivityHighBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="PalmEraserSensitivity_High" Margin="0,0,0,0" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="高敏感度"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
using Ink_Canvas;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using Application = System.Windows.Application;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
@@ -9,9 +14,41 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
/// </summary>
|
||||
public partial class GesturesPanel : UserControl
|
||||
{
|
||||
private bool _isLoaded = false;
|
||||
|
||||
public GesturesPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += GesturesPanel_Loaded;
|
||||
}
|
||||
|
||||
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);
|
||||
}), System.Windows.Threading.DispatcherPriority.Loaded);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"GesturesPanel 启用触摸支持时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<RoutedEventArgs> IsTopBarNeedShadowEffect;
|
||||
@@ -29,6 +66,261 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载设置到UI
|
||||
/// </summary>
|
||||
public void LoadSettings()
|
||||
{
|
||||
if (MainWindow.Settings == null) return;
|
||||
|
||||
_isLoaded = false;
|
||||
|
||||
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}");
|
||||
}
|
||||
|
||||
_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))
|
||||
: new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var innerBorder = toggleSwitch.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
innerBorder.HorizontalAlignment = isOn ? HorizontalAlignment.Right : HorizontalAlignment.Left;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置选项按钮状态
|
||||
/// </summary>
|
||||
private void SetOptionButtonState(string group, int selectedIndex)
|
||||
{
|
||||
var buttons = new Dictionary<string, string[]>
|
||||
{
|
||||
{ "PalmEraserSensitivity", new[] { "Low", "Medium", "High" } }
|
||||
};
|
||||
|
||||
if (!buttons.ContainsKey(group)) return;
|
||||
|
||||
string[] buttonNames = buttons[group];
|
||||
|
||||
for (int i = 0; i < buttonNames.Length; i++)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ToggleSwitch点击事件处理
|
||||
/// </summary>
|
||||
private void ToggleSwitch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
bool isOn = border.Background.ToString() == "#FF3584E4";
|
||||
bool newState = !isOn;
|
||||
SetToggleSwitchState(border, newState);
|
||||
|
||||
string tag = border.Tag?.ToString();
|
||||
if (string.IsNullOrEmpty(tag)) return;
|
||||
|
||||
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;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选项按钮点击事件处理
|
||||
/// </summary>
|
||||
private void OptionButton_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 + "_"))
|
||||
{
|
||||
childBorder.Background = new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = childBorder.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 设置当前按钮为选中状态
|
||||
border.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var currentTextBlock = border.Child as TextBlock;
|
||||
if (currentTextBlock != null)
|
||||
{
|
||||
currentTextBlock.FontWeight = FontWeights.Bold;
|
||||
}
|
||||
|
||||
switch (group)
|
||||
{
|
||||
case "PalmEraserSensitivity":
|
||||
int sensitivity;
|
||||
switch (value)
|
||||
{
|
||||
case "Low":
|
||||
sensitivity = 0;
|
||||
break;
|
||||
case "Medium":
|
||||
sensitivity = 1;
|
||||
break;
|
||||
case "High":
|
||||
sensitivity = 2;
|
||||
break;
|
||||
default:
|
||||
sensitivity = 0;
|
||||
break;
|
||||
}
|
||||
// 调用 MainWindow 中的方法(通过设置 ComboBox 的 SelectedIndex)
|
||||
var mainWindow = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow != null)
|
||||
{
|
||||
var comboBox = mainWindow.FindName("ComboBoxPalmEraserSensitivity") as System.Windows.Controls.ComboBox;
|
||||
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)
|
||||
{
|
||||
MainWindow.Settings.Canvas.PalmEraserSensitivity = sensitivity;
|
||||
}
|
||||
}, "ComboBoxPalmEraserSensitivity");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"GesturesPanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,21 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"InkRecognitionPanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<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="ToggleSwitchDisplayRandWindowNamesInputBtn" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -49,7 +49,7 @@
|
||||
<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="ToggleSwitchShowRandomAndSingleDraw" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -63,7 +63,7 @@
|
||||
<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="ToggleSwitchEnableQuickDraw" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -77,7 +77,7 @@
|
||||
<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="ToggleSwitchExternalCaller" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -92,13 +92,13 @@
|
||||
<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">
|
||||
<Border x:Name="ExternalCallerTypeClassIslandBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" 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">
|
||||
<Border x:Name="ExternalCallerTypeSecRandomBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="ExternalCallerType_SecRandom" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="SecRandom点名"/>
|
||||
</Border>
|
||||
<Border x:Name="ExternalCallerTypeNamePickerBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="ExternalCallerType_NamePicker" Margin="0,0,8,8">
|
||||
<Border x:Name="ExternalCallerTypeNamePickerBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="ExternalCallerType_NamePicker" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="NamePicker点名"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
@@ -115,7 +115,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="设置单次抽人窗口自动关闭的延迟时间" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="RandWindowOnceCloseLatencySlider" Width="150" Minimum="0.5" Maximum="8" Value="2.5" TickFrequency="0.1" IsSnapToTickEnabled="True"/>
|
||||
<Slider x:Name="RandWindowOnceCloseLatencySlider" Width="150" Minimum="0.5" Maximum="8" Value="2.5" TickFrequency="0.1" IsSnapToTickEnabled="True" ValueChanged="RandWindowOnceCloseLatencySlider_ValueChanged"/>
|
||||
<TextBlock x:Name="RandWindowOnceCloseLatencyText" Text="2.5s" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
@@ -126,7 +126,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="设置单次随机点名最多抽取的人数" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="RandWindowOnceMaxStudentsSlider" Width="150" Minimum="0" Maximum="20" Value="10" TickFrequency="1" IsSnapToTickEnabled="True"/>
|
||||
<Slider x:Name="RandWindowOnceMaxStudentsSlider" Width="150" Minimum="0" Maximum="20" Value="10" TickFrequency="1" IsSnapToTickEnabled="True" ValueChanged="RandWindowOnceMaxStudentsSlider_ValueChanged"/>
|
||||
<TextBlock x:Name="RandWindowOnceMaxStudentsText" Text="10" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
@@ -142,7 +142,7 @@
|
||||
<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="ToggleSwitchUseNewRollCallUI" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -156,7 +156,7 @@
|
||||
<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="ToggleSwitchEnableMLAvoidance" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -171,7 +171,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="设置用于避免重复的历史记录数量" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="MLAvoidanceHistorySlider" Width="150" Minimum="5" Maximum="50" Value="50" TickFrequency="5" IsSnapToTickEnabled="True"/>
|
||||
<Slider x:Name="MLAvoidanceHistorySlider" Width="150" Minimum="5" Maximum="50" Value="50" TickFrequency="5" IsSnapToTickEnabled="True" ValueChanged="MLAvoidanceHistorySlider_ValueChanged"/>
|
||||
<TextBlock x:Name="MLAvoidanceHistoryText" Text="50" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
@@ -182,7 +182,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="设置机器学习算法避免重复的权重" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="MLAvoidanceWeightSlider" Width="150" Minimum="0.1" Maximum="1.0" Value="1.0" TickFrequency="0.1" IsSnapToTickEnabled="True"/>
|
||||
<Slider x:Name="MLAvoidanceWeightSlider" Width="150" Minimum="0.1" Maximum="1.0" Value="1.0" TickFrequency="0.1" IsSnapToTickEnabled="True" ValueChanged="MLAvoidanceWeightSlider_ValueChanged"/>
|
||||
<TextBlock x:Name="MLAvoidanceWeightText" Text="100%" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436" FontFamily="Consolas"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
@@ -201,7 +201,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">
|
||||
<Border x:Name="PickNameBackgroundDefaultBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="PickNameBackground_Default" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="默认背景"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
using Ink_Canvas;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using Application = System.Windows.Application;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
@@ -9,9 +15,41 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
/// </summary>
|
||||
public partial class LuckyRandomPanel : UserControl
|
||||
{
|
||||
private bool _isLoaded = false;
|
||||
|
||||
public LuckyRandomPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += LuckyRandomPanel_Loaded;
|
||||
}
|
||||
|
||||
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);
|
||||
}), System.Windows.Threading.DispatcherPriority.Loaded);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"LuckyRandomPanel 启用触摸支持时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<RoutedEventArgs> IsTopBarNeedShadowEffect;
|
||||
@@ -29,6 +67,379 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载设置到UI
|
||||
/// </summary>
|
||||
public void LoadSettings()
|
||||
{
|
||||
if (MainWindow.Settings == null || MainWindow.Settings.RandSettings == null) return;
|
||||
|
||||
_isLoaded = false;
|
||||
|
||||
try
|
||||
{
|
||||
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;
|
||||
if (RandWindowOnceCloseLatencyText != null)
|
||||
{
|
||||
RandWindowOnceCloseLatencyText.Text = $"{randSettings.RandWindowOnceCloseLatency:F1}s";
|
||||
}
|
||||
}
|
||||
|
||||
// 单次随机点名人数上限
|
||||
if (RandWindowOnceMaxStudentsSlider != null)
|
||||
{
|
||||
RandWindowOnceMaxStudentsSlider.Value = randSettings.RandWindowOnceMaxStudents;
|
||||
if (RandWindowOnceMaxStudentsText != null)
|
||||
{
|
||||
RandWindowOnceMaxStudentsText.Text = randSettings.RandWindowOnceMaxStudents.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
// 启用新点名UI
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchUseNewRollCallUI"), randSettings.UseNewRollCallUI);
|
||||
|
||||
// 启用机器学习避免重复
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableMLAvoidance"), randSettings.EnableMLAvoidance);
|
||||
|
||||
// 避免重复历史记录数量
|
||||
if (MLAvoidanceHistorySlider != null)
|
||||
{
|
||||
MLAvoidanceHistorySlider.Value = randSettings.MLAvoidanceHistoryCount;
|
||||
if (MLAvoidanceHistoryText != null)
|
||||
{
|
||||
MLAvoidanceHistoryText.Text = randSettings.MLAvoidanceHistoryCount.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
// 避免重复权重
|
||||
if (MLAvoidanceWeightSlider != null)
|
||||
{
|
||||
MLAvoidanceWeightSlider.Value = randSettings.MLAvoidanceWeight;
|
||||
if (MLAvoidanceWeightText != null)
|
||||
{
|
||||
MLAvoidanceWeightText.Text = $"{(randSettings.MLAvoidanceWeight * 100):F0}%";
|
||||
}
|
||||
}
|
||||
|
||||
// 背景选择
|
||||
SetOptionButtonState("PickNameBackground", randSettings.SelectedBackgroundIndex);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
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))
|
||||
: new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var innerBorder = toggleSwitch.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
innerBorder.HorizontalAlignment = isOn ? HorizontalAlignment.Right : HorizontalAlignment.Left;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置选项按钮状态
|
||||
/// </summary>
|
||||
private void SetOptionButtonState(string group, int selectedIndex)
|
||||
{
|
||||
var buttons = new Dictionary<string, string[]>
|
||||
{
|
||||
{ "ExternalCallerType", new[] { "ClassIsland", "SecRandom", "NamePicker" } },
|
||||
{ "PickNameBackground", new[] { "Default" } }
|
||||
};
|
||||
|
||||
if (!buttons.ContainsKey(group)) return;
|
||||
|
||||
string[] buttonNames = buttons[group];
|
||||
|
||||
for (int i = 0; i < buttonNames.Length; i++)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ToggleSwitch点击事件处理
|
||||
/// </summary>
|
||||
private void ToggleSwitch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
bool isOn = border.Background.ToString() == "#FF3584E4";
|
||||
bool newState = !isOn;
|
||||
SetToggleSwitchState(border, newState);
|
||||
|
||||
string tag = border.Tag?.ToString();
|
||||
if (string.IsNullOrEmpty(tag)) return;
|
||||
|
||||
var randSettings = MainWindow.Settings.RandSettings;
|
||||
if (randSettings == null) return;
|
||||
|
||||
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;
|
||||
|
||||
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 + "_"))
|
||||
{
|
||||
childBorder.Background = new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = childBorder.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 设置当前按钮为选中状态
|
||||
border.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var currentTextBlock = border.Child as TextBlock;
|
||||
if (currentTextBlock != null)
|
||||
{
|
||||
currentTextBlock.FontWeight = FontWeights.Bold;
|
||||
}
|
||||
|
||||
var randSettings = MainWindow.Settings.RandSettings;
|
||||
if (randSettings == null) return;
|
||||
|
||||
switch (group)
|
||||
{
|
||||
case "ExternalCallerType":
|
||||
int callerType;
|
||||
switch (value)
|
||||
{
|
||||
case "ClassIsland":
|
||||
callerType = 0;
|
||||
break;
|
||||
case "SecRandom":
|
||||
callerType = 1;
|
||||
break;
|
||||
case "NamePicker":
|
||||
callerType = 2;
|
||||
break;
|
||||
default:
|
||||
callerType = 0;
|
||||
break;
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
var mainWindow = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow != null)
|
||||
{
|
||||
var comboBox = mainWindow.FindName("ComboBoxExternalCallerType") as System.Windows.Controls.ComboBox;
|
||||
if (comboBox != null && comboBox.Items.Count > callerType)
|
||||
{
|
||||
comboBox.SelectedIndex = callerType;
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChanged("ComboBoxExternalCallerType", comboBox.Items[callerType]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
randSettings.ExternalCallerType = callerType;
|
||||
}, "ComboBoxExternalCallerType");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "PickNameBackground":
|
||||
// 背景选择逻辑 - 这个设置可能没有对应的方法,直接更新
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
randSettings.SelectedBackgroundIndex = 0; // 默认背景
|
||||
}, "PickNameBackground");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Slider值变化事件处理
|
||||
/// </summary>
|
||||
private void RandWindowOnceCloseLatencySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
if (RandWindowOnceCloseLatencySlider != null && RandWindowOnceCloseLatencyText != null)
|
||||
{
|
||||
double value = RandWindowOnceCloseLatencySlider.Value;
|
||||
RandWindowOnceCloseLatencyText.Text = $"{value:F1}s";
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("RandWindowOnceCloseLatencySlider", value);
|
||||
}
|
||||
}
|
||||
|
||||
private void RandWindowOnceMaxStudentsSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
if (RandWindowOnceMaxStudentsSlider != null && RandWindowOnceMaxStudentsText != null)
|
||||
{
|
||||
double value = RandWindowOnceMaxStudentsSlider.Value;
|
||||
RandWindowOnceMaxStudentsText.Text = ((int)value).ToString();
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("RandWindowOnceMaxStudentsSlider", value);
|
||||
}
|
||||
}
|
||||
|
||||
private void MLAvoidanceHistorySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
if (MLAvoidanceHistorySlider != null && MLAvoidanceHistoryText != null)
|
||||
{
|
||||
double value = MLAvoidanceHistorySlider.Value;
|
||||
MLAvoidanceHistoryText.Text = ((int)value).ToString();
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("MLAvoidanceHistorySlider", value);
|
||||
}
|
||||
}
|
||||
|
||||
private void MLAvoidanceWeightSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
if (MLAvoidanceWeightSlider != null && MLAvoidanceWeightText != null)
|
||||
{
|
||||
double value = MLAvoidanceWeightSlider.Value;
|
||||
MLAvoidanceWeightText.Text = $"{(value * 100):F0}%";
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("MLAvoidanceWeightSlider", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"LuckyRandomPanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,719 @@
|
||||
using Ink_Canvas;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
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
|
||||
{
|
||||
var mainWindow = GetMainWindow();
|
||||
if (mainWindow == null) return;
|
||||
|
||||
var method = mainWindow.GetType().GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
|
||||
if (method != null)
|
||||
{
|
||||
method.Invoke(mainWindow, parameters);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
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"))
|
||||
{
|
||||
var isOnProperty = property.PropertyType.GetProperty("IsOn");
|
||||
if (isOnProperty != null)
|
||||
{
|
||||
var toggleSwitchInstance = property.GetValue(mainWindow);
|
||||
if (toggleSwitchInstance != null)
|
||||
{
|
||||
isOnProperty.SetValue(toggleSwitchInstance, isOn);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 即使找不到控件,也尝试触发事件(可能通过反射调用)
|
||||
var toggledMethodName = toggleSwitchName + "_Toggled";
|
||||
InvokeMainWindowMethod(toggledMethodName, null, new RoutedEventArgs());
|
||||
|
||||
// 通知新设置面板同步状态
|
||||
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)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"调用 ToggleSwitch {toggleSwitchName} 失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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",
|
||||
checkBoxName + "_IsCheckChange",
|
||||
checkBoxName + "_Checked",
|
||||
checkBoxName + "_Unchecked"
|
||||
};
|
||||
|
||||
foreach (var methodName in methodNames)
|
||||
{
|
||||
var method = mainWindow.GetType().GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
|
||||
if (method != null)
|
||||
{
|
||||
InvokeMainWindowMethod(methodName, checkBox, new RoutedEventArgs());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
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();
|
||||
if (mainWindow != null)
|
||||
{
|
||||
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);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 如果没有事件处理方法或调用失败,直接修改设置并保存
|
||||
action?.Invoke();
|
||||
MainWindow.SaveSettingsToFile();
|
||||
|
||||
// 如果提供了控件名称,通知面板同步状态
|
||||
if (!string.IsNullOrEmpty(controlName))
|
||||
{
|
||||
NotifySettingsPanelsSyncState(controlName);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
loadMethod.Invoke(panel, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果无法确定具体面板,则同步所有面板(保守策略)
|
||||
SyncAllPanels(window);
|
||||
}
|
||||
break; // 通常只有一个设置窗口
|
||||
}
|
||||
}
|
||||
}), System.Windows.Threading.DispatcherPriority.Background);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
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" },
|
||||
{ "ToggleSwitchEnableTrayIcon", "ThemePanel" },
|
||||
{ "ComboBoxFloatingBarImg", "ThemePanel" },
|
||||
{ "ComboBoxUnFoldBtnImg", "ThemePanel" },
|
||||
{ "ComboBoxChickenSoupSource", "ThemePanel" },
|
||||
{ "ComboBoxQuickColorPaletteDisplayMode", "ThemePanel" },
|
||||
{ "ComboBoxEraserDisplayOption", "ThemePanel" },
|
||||
{ "ToggleSwitchEnableQuickPanel", "ThemePanel" },
|
||||
{ "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" },
|
||||
{ "ToggleSwitchIsSaveLogByDate", "AdvancedPanel" },
|
||||
{ "ToggleSwitchIsSecondConfimeWhenShutdownApp", "AdvancedPanel" },
|
||||
{ "ToggleSwitchIsEnableFullScreenHelper", "AdvancedPanel" },
|
||||
{ "ToggleSwitchIsEnableAvoidFullScreenHelper", "AdvancedPanel" },
|
||||
{ "ToggleSwitchIsEnableEdgeGestureUtil", "AdvancedPanel" },
|
||||
{ "ToggleSwitchIsEnableForceFullScreen", "AdvancedPanel" },
|
||||
{ "ToggleSwitchIsEnableDPIChangeDetection", "AdvancedPanel" },
|
||||
{ "ToggleSwitchIsEnableResolutionChangeDetection", "AdvancedPanel" },
|
||||
{ "ToggleSwitchIsAutoBackupBeforeUpdate", "AdvancedPanel" },
|
||||
{ "ToggleSwitchIsAutoBackupEnabled", "AdvancedPanel" },
|
||||
|
||||
// LuckyRandomPanel
|
||||
{ "ToggleSwitchDisplayRandWindowNamesInputBtn", "LuckyRandomPanel" },
|
||||
{ "ToggleSwitchShowRandomAndSingleDraw", "LuckyRandomPanel" },
|
||||
{ "ToggleSwitchEnableQuickDraw", "LuckyRandomPanel" },
|
||||
{ "ToggleSwitchExternalCaller", "LuckyRandomPanel" },
|
||||
{ "ComboBoxExternalCallerType", "LuckyRandomPanel" },
|
||||
{ "RandWindowOnceCloseLatencySlider", "LuckyRandomPanel" },
|
||||
{ "RandWindowOnceMaxStudentsSlider", "LuckyRandomPanel" },
|
||||
};
|
||||
|
||||
// 查找匹配的面板
|
||||
foreach (var kvp in controlToPanel)
|
||||
{
|
||||
if (controlName.Contains(kvp.Key) || kvp.Key.Contains(controlName))
|
||||
{
|
||||
return kvp.Value;
|
||||
}
|
||||
}
|
||||
|
||||
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)));
|
||||
|
||||
foreach (var panelProp in panelProperties)
|
||||
{
|
||||
try
|
||||
{
|
||||
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)
|
||||
{
|
||||
loadMethod.Invoke(panel, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"同步面板 {panelProp.Name} 状态失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
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" // 主题(选项按钮)
|
||||
};
|
||||
|
||||
// 检查是否是主题相关的设置(使用更灵活的匹配)
|
||||
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)
|
||||
{
|
||||
isThemeRelated = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isThemeRelated)
|
||||
{
|
||||
// 延迟通知,确保设置已保存
|
||||
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
// 通知设置窗口更新主题
|
||||
NotifySettingsWindowThemeUpdate();
|
||||
}), System.Windows.Threading.DispatcherPriority.Background);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
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)
|
||||
{
|
||||
applyThemeMethod.Invoke(window, null);
|
||||
}
|
||||
|
||||
break; // 通常只有一个设置窗口
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
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;
|
||||
|
||||
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);
|
||||
var mouseEvent = new MouseButtonEventArgs(Mouse.PrimaryDevice, Environment.TickCount, MouseButton.Left)
|
||||
{
|
||||
RoutedEvent = UIElement.MouseLeftButtonDownEvent,
|
||||
Source = border
|
||||
};
|
||||
border.RaiseEvent(mouseEvent);
|
||||
border.CaptureTouch(e.TouchDevice);
|
||||
e.Handled = true;
|
||||
};
|
||||
|
||||
// 添加触摸释放事件
|
||||
border.TouchUp += (s, e) =>
|
||||
{
|
||||
border.ReleaseTouchCapture(e.TouchDevice);
|
||||
e.Handled = true;
|
||||
};
|
||||
}
|
||||
}
|
||||
// 为 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<Image Source="/Resources/Icons-png/Powerpoint.png" Margin="0,0,6,0" Width="28" Height="28" VerticalAlignment="Center"/>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="Microsoft PowerPoint 支持" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchSupportPowerPoint" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -51,7 +51,7 @@
|
||||
<Image Source="/Resources/Icons-png/Powerpoint.png" Margin="0,0,6,0" Width="28" Height="28" VerticalAlignment="Center"/>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="PowerPoint 联动增强" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchPowerPointEnhancement" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -65,7 +65,7 @@
|
||||
<Image Source="/Resources/Icons-png/WPS.png" Margin="0,0,6,0" Width="28" Height="28" VerticalAlignment="Center"/>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="WPS 支持" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchSupportWPS" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -79,7 +79,7 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="WPP进程查杀(防止WPP残留进程)" HorizontalAlignment="Left"/>
|
||||
<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">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -160,7 +160,7 @@
|
||||
<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="ToggleSwitchShowPPTButton" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -170,114 +170,178 @@
|
||||
</Grid>
|
||||
<StackPanel x:Name="PPTButtonSettingsPanel" Margin="0,12,0,0" Visibility="Visible">
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,0,0,12">
|
||||
<CheckBox x:Name="CheckboxEnableLBPPTButton" IsChecked="True" Content="左下" Margin="0,0,16,0"/>
|
||||
<CheckBox x:Name="CheckboxEnableRBPPTButton" IsChecked="True" Content="右下" Margin="0,0,16,0"/>
|
||||
<CheckBox x:Name="CheckboxEnableLSPPTButton" IsChecked="True" Content="左侧" Margin="0,0,16,0"/>
|
||||
<CheckBox x:Name="CheckboxEnableRSPPTButton" IsChecked="True" Content="右侧"/>
|
||||
<CheckBox x:Name="CheckboxEnableLBPPTButton" IsChecked="True" Content="左下" Margin="0,0,16,0" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
<CheckBox x:Name="CheckboxEnableRBPPTButton" IsChecked="True" Content="右下" Margin="0,0,16,0" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
<CheckBox x:Name="CheckboxEnableLSPPTButton" IsChecked="True" Content="左侧" Margin="0,0,16,0" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
<CheckBox x:Name="CheckboxEnableRSPPTButton" IsChecked="True" Content="右侧" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
</StackPanel>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="0">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="左侧偏移" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="调大往上偏移,调小往下偏移,修改为0为不偏移,居中放置" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="PPTButtonLeftPositionValueSlider" Width="150" Minimum="-500" Maximum="500" Value="0" TickFrequency="1" IsSnapToTickEnabled="True"/>
|
||||
<TextBlock x:Name="PPTButtonLeftPositionValueText" Text="0" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
|
||||
</StackPanel>
|
||||
<Grid Grid.Column="1" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition Width="50"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Slider x:Name="PPTButtonLeftPositionValueSlider" Grid.Column="0" Minimum="-500" Maximum="500" Value="0" TickFrequency="1" IsSnapToTickEnabled="True" ValueChanged="PPTButtonPositionSlider_ValueChanged"/>
|
||||
<TextBlock x:Name="PPTButtonLeftPositionValueText" Grid.Column="1" Text="0" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436" TextAlignment="Left"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="0">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="右侧偏移" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="调大往右偏移,调小往左偏移,修改为0为不偏移,居中放置" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="PPTButtonRightPositionValueSlider" Width="150" Minimum="-500" Maximum="500" Value="0" TickFrequency="1" IsSnapToTickEnabled="True"/>
|
||||
<TextBlock x:Name="PPTButtonRightPositionValueText" Text="0" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
|
||||
</StackPanel>
|
||||
<Grid Grid.Column="1" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition Width="50"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Slider x:Name="PPTButtonRightPositionValueSlider" Grid.Column="0" Minimum="-500" Maximum="500" Value="0" TickFrequency="1" IsSnapToTickEnabled="True" ValueChanged="PPTButtonPositionSlider_ValueChanged"/>
|
||||
<TextBlock x:Name="PPTButtonRightPositionValueText" Grid.Column="1" Text="0" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436" TextAlignment="Left"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="0">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="左下偏移" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="调整左下按钮的位置" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="PPTButtonLBPositionValueSlider" Width="150" Minimum="-500" Maximum="500" Value="0" TickFrequency="1" IsSnapToTickEnabled="True"/>
|
||||
<TextBlock x:Name="PPTButtonLBPositionValueText" Text="0" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
|
||||
</StackPanel>
|
||||
<Grid Grid.Column="1" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition Width="50"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Slider x:Name="PPTButtonLBPositionValueSlider" Grid.Column="0" Minimum="-500" Maximum="500" Value="0" TickFrequency="1" IsSnapToTickEnabled="True" ValueChanged="PPTButtonPositionSlider_ValueChanged"/>
|
||||
<TextBlock x:Name="PPTButtonLBPositionValueText" Grid.Column="1" Text="0" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436" TextAlignment="Left"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="0">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="右下偏移" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="调整右下按钮的位置" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="PPTButtonRBPositionValueSlider" Width="150" Minimum="-500" Maximum="500" Value="0" TickFrequency="1" IsSnapToTickEnabled="True"/>
|
||||
<TextBlock x:Name="PPTButtonRBPositionValueText" Text="0" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
|
||||
</StackPanel>
|
||||
<Grid Grid.Column="1" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition Width="50"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Slider x:Name="PPTButtonRBPositionValueSlider" Grid.Column="0" Minimum="-500" Maximum="500" Value="0" TickFrequency="1" IsSnapToTickEnabled="True" ValueChanged="PPTButtonPositionSlider_ValueChanged"/>
|
||||
<TextBlock x:Name="PPTButtonRBPositionValueText" Grid.Column="1" Text="0" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436" TextAlignment="Left"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<TextBlock Text="两侧按钮设置" FontWeight="Bold" Foreground="#2e3436" FontSize="16" Margin="0,0,0,8"/>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,0,0,8">
|
||||
<CheckBox x:Name="CheckboxSPPTDisplayPage" IsChecked="True" Content="显示页码" Margin="0,0,16,0"/>
|
||||
<CheckBox x:Name="CheckboxSPPTHalfOpacity" IsChecked="True" Content="半透明" Margin="0,0,16,0"/>
|
||||
<CheckBox x:Name="CheckboxSPPTBlackBackground" IsChecked="True" Content="黑色背景"/>
|
||||
<CheckBox x:Name="CheckboxSPPTDisplayPage" IsChecked="True" Content="显示页码" Margin="0,0,16,0" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
<CheckBox x:Name="CheckboxSPPTHalfOpacity" IsChecked="True" Content="半透明" Margin="0,0,16,0" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
<CheckBox x:Name="CheckboxSPPTBlackBackground" IsChecked="True" Content="黑色背景" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
</StackPanel>
|
||||
<StackPanel x:Name="PPTLSButtonOpacityPanel" Margin="0,8,0,8" Visibility="Visible">
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="0">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="左侧按钮透明度" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="调整左侧翻页按钮的透明度" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="PPTLSButtonOpacityValueSlider" Width="150" Minimum="0.1" Maximum="1.0" Value="0.5" TickFrequency="0.1" IsSnapToTickEnabled="True"/>
|
||||
<TextBlock x:Name="PPTLSButtonOpacityValueText" Text="0.5" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
|
||||
</StackPanel>
|
||||
<Grid Grid.Column="1" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition Width="50"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Slider x:Name="PPTLSButtonOpacityValueSlider" Grid.Column="0" Minimum="0.1" Maximum="1.0" Value="0.5" TickFrequency="0.1" IsSnapToTickEnabled="True" ValueChanged="PPTButtonOpacitySlider_ValueChanged"/>
|
||||
<TextBlock x:Name="PPTLSButtonOpacityValueText" Grid.Column="1" Text="0.5" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436" TextAlignment="Left"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<StackPanel x:Name="PPTRSButtonOpacityPanel" Margin="0,8,0,8" Visibility="Visible">
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="0">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="右侧按钮透明度" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="调整右侧翻页按钮的透明度" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="PPTRSButtonOpacityValueSlider" Width="150" Minimum="0.1" Maximum="1.0" Value="0.5" TickFrequency="0.1" IsSnapToTickEnabled="True"/>
|
||||
<TextBlock x:Name="PPTRSButtonOpacityValueText" Text="0.5" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
|
||||
</StackPanel>
|
||||
<Grid Grid.Column="1" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition Width="50"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Slider x:Name="PPTRSButtonOpacityValueSlider" Grid.Column="0" Minimum="0.1" Maximum="1.0" Value="0.5" TickFrequency="0.1" IsSnapToTickEnabled="True" ValueChanged="PPTButtonOpacitySlider_ValueChanged"/>
|
||||
<TextBlock x:Name="PPTRSButtonOpacityValueText" Grid.Column="1" Text="0.5" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436" TextAlignment="Left"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<TextBlock Text="左下右下按钮设置" FontWeight="Bold" Foreground="#2e3436" FontSize="16" Margin="0,0,0,8"/>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,0,0,8">
|
||||
<CheckBox x:Name="CheckboxBPPTDisplayPage" IsChecked="True" Content="显示页码" Margin="0,0,16,0"/>
|
||||
<CheckBox x:Name="CheckboxBPPTHalfOpacity" IsChecked="True" Content="半透明" Margin="0,0,16,0"/>
|
||||
<CheckBox x:Name="CheckboxBPPTBlackBackground" IsChecked="True" Content="黑色背景"/>
|
||||
<CheckBox x:Name="CheckboxBPPTDisplayPage" IsChecked="True" Content="显示页码" Margin="0,0,16,0" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
<CheckBox x:Name="CheckboxBPPTHalfOpacity" IsChecked="True" Content="半透明" Margin="0,0,16,0" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
<CheckBox x:Name="CheckboxBPPTBlackBackground" IsChecked="True" Content="黑色背景" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
</StackPanel>
|
||||
<StackPanel x:Name="PPTLBButtonOpacityPanel" Margin="0,8,0,8" Visibility="Visible">
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="0">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="左下按钮透明度" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="调整左下翻页按钮的透明度" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="PPTLBButtonOpacityValueSlider" Width="150" Minimum="0.1" Maximum="1.0" Value="0.5" TickFrequency="0.1" IsSnapToTickEnabled="True"/>
|
||||
<TextBlock x:Name="PPTLBButtonOpacityValueText" Text="0.5" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
|
||||
</StackPanel>
|
||||
<Grid Grid.Column="1" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition Width="50"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Slider x:Name="PPTLBButtonOpacityValueSlider" Grid.Column="0" Minimum="0.1" Maximum="1.0" Value="0.5" TickFrequency="0.1" IsSnapToTickEnabled="True" ValueChanged="PPTButtonOpacitySlider_ValueChanged"/>
|
||||
<TextBlock x:Name="PPTLBButtonOpacityValueText" Grid.Column="1" Text="0.5" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436" TextAlignment="Left"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<StackPanel x:Name="PPTRBButtonOpacityPanel" Margin="0,8,0,8" Visibility="Visible">
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="0">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="右下按钮透明度" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="调整右下翻页按钮的透明度" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="PPTRBButtonOpacityValueSlider" Width="150" Minimum="0.1" Maximum="1.0" Value="0.5" TickFrequency="0.1" IsSnapToTickEnabled="True"/>
|
||||
<TextBlock x:Name="PPTRBButtonOpacityValueText" Text="0.5" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
|
||||
</StackPanel>
|
||||
<Grid Grid.Column="1" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition Width="50"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Slider x:Name="PPTRBButtonOpacityValueSlider" Grid.Column="0" Minimum="0.1" Maximum="1.0" Value="0.5" TickFrequency="0.1" IsSnapToTickEnabled="True" ValueChanged="PPTButtonOpacitySlider_ValueChanged"/>
|
||||
<TextBlock x:Name="PPTRBButtonOpacityValueText" Grid.Column="1" Text="0.5" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436" TextAlignment="Left"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
@@ -290,7 +354,7 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="PPT 页码按钮可点击" HorizontalAlignment="Left"/>
|
||||
<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">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -308,7 +372,7 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="PPT 翻页按钮长按翻页" HorizontalAlignment="Left"/>
|
||||
<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">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -326,7 +390,7 @@
|
||||
<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="ToggleSwitchSkipAnimationsWhenGoNext" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Grid.Column="1" VerticalAlignment="Top" Margin="0,8,0,0">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -346,7 +410,7 @@
|
||||
<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="ToggleSwitchShowCanvasAtNewSlideShow" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -378,7 +442,7 @@
|
||||
<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="ToggleSwitchEnableTwoFingerGestureInPresentationMode" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -392,7 +456,7 @@
|
||||
<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="ToggleSwitchEnableFingerGestureSlideShowControl" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -406,7 +470,7 @@
|
||||
<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="ToggleSwitchShowGestureButtonInSlideShow" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -425,7 +489,7 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="PPT时间显示胶囊" HorizontalAlignment="Left"/>
|
||||
<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">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -440,13 +504,13 @@
|
||||
<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">
|
||||
<Border x:Name="PPTTimeCapsulePositionTopLeftBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" 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">
|
||||
<Border x:Name="PPTTimeCapsulePositionTopRightBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="PPTTimeCapsulePosition_TopRight" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="右上角"/>
|
||||
</Border>
|
||||
<Border x:Name="PPTTimeCapsulePositionTopCenterBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="PPTTimeCapsulePosition_TopCenter" Margin="0,0,8,8">
|
||||
<Border x:Name="PPTTimeCapsulePositionTopCenterBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="PPTTimeCapsulePosition_TopCenter" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="顶部居中"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
@@ -462,7 +526,7 @@
|
||||
<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="ToggleSwitchNotifyPreviousPage" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -476,7 +540,7 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="进入放映时回到首页" HorizontalAlignment="Left"/>
|
||||
<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">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -490,7 +554,7 @@
|
||||
<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="ToggleSwitchNotifyHiddenPage" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -504,7 +568,7 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="提示是否已启用自动播放" HorizontalAlignment="Left"/>
|
||||
<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">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
using Ink_Canvas;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
@@ -9,9 +14,41 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
/// </summary>
|
||||
public partial class PowerPointPanel : UserControl
|
||||
{
|
||||
private bool _isLoaded = false;
|
||||
|
||||
public PowerPointPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += PowerPointPanel_Loaded;
|
||||
}
|
||||
|
||||
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);
|
||||
}), System.Windows.Threading.DispatcherPriority.Loaded);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"PowerPointPanel 启用触摸支持时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<RoutedEventArgs> IsTopBarNeedShadowEffect;
|
||||
@@ -29,6 +66,583 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载设置到UI
|
||||
/// </summary>
|
||||
public void LoadSettings()
|
||||
{
|
||||
if (MainWindow.Settings == null || MainWindow.Settings.PowerPointSettings == null) return;
|
||||
|
||||
_isLoaded = false;
|
||||
|
||||
try
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (CheckboxEnableLBPPTButton != null) CheckboxEnableLBPPTButton.IsChecked = dopsc[0] == '2';
|
||||
if (CheckboxEnableRBPPTButton != null) CheckboxEnableRBPPTButton.IsChecked = dopsc[1] == '2';
|
||||
if (CheckboxEnableLSPPTButton != null) CheckboxEnableLSPPTButton.IsChecked = dopsc[2] == '2';
|
||||
if (CheckboxEnableRSPPTButton != null) CheckboxEnableRSPPTButton.IsChecked = dopsc[3] == '2';
|
||||
}
|
||||
|
||||
// 按钮位置
|
||||
if (PPTButtonLeftPositionValueSlider != null)
|
||||
{
|
||||
PPTButtonLeftPositionValueSlider.Value = pptSettings.PPTLSButtonPosition;
|
||||
if (PPTButtonLeftPositionValueText != null)
|
||||
{
|
||||
PPTButtonLeftPositionValueText.Text = pptSettings.PPTLSButtonPosition.ToString();
|
||||
}
|
||||
}
|
||||
if (PPTButtonRightPositionValueSlider != null)
|
||||
{
|
||||
PPTButtonRightPositionValueSlider.Value = pptSettings.PPTRSButtonPosition;
|
||||
if (PPTButtonRightPositionValueText != null)
|
||||
{
|
||||
PPTButtonRightPositionValueText.Text = pptSettings.PPTRSButtonPosition.ToString();
|
||||
}
|
||||
}
|
||||
if (PPTButtonLBPositionValueSlider != null)
|
||||
{
|
||||
PPTButtonLBPositionValueSlider.Value = pptSettings.PPTLBButtonPosition;
|
||||
if (PPTButtonLBPositionValueText != null)
|
||||
{
|
||||
PPTButtonLBPositionValueText.Text = pptSettings.PPTLBButtonPosition.ToString();
|
||||
}
|
||||
}
|
||||
if (PPTButtonRBPositionValueSlider != null)
|
||||
{
|
||||
PPTButtonRBPositionValueSlider.Value = pptSettings.PPTRBButtonPosition;
|
||||
if (PPTButtonRBPositionValueText != null)
|
||||
{
|
||||
PPTButtonRBPositionValueText.Text = pptSettings.PPTRBButtonPosition.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
// 两侧按钮选项
|
||||
var sops = pptSettings.PPTSButtonsOption.ToString();
|
||||
var sopsc = sops.ToCharArray();
|
||||
if (sopsc.Length >= 3)
|
||||
{
|
||||
if (CheckboxSPPTDisplayPage != null) CheckboxSPPTDisplayPage.IsChecked = sopsc[0] == '2';
|
||||
if (CheckboxSPPTHalfOpacity != null) CheckboxSPPTHalfOpacity.IsChecked = sopsc[1] == '2';
|
||||
if (CheckboxSPPTBlackBackground != null) CheckboxSPPTBlackBackground.IsChecked = sopsc[2] == '2';
|
||||
}
|
||||
|
||||
// 左下右下按钮选项
|
||||
var bops = pptSettings.PPTBButtonsOption.ToString();
|
||||
var bopsc = bops.ToCharArray();
|
||||
if (bopsc.Length >= 3)
|
||||
{
|
||||
if (CheckboxBPPTDisplayPage != null) CheckboxBPPTDisplayPage.IsChecked = bopsc[0] == '2';
|
||||
if (CheckboxBPPTHalfOpacity != null) CheckboxBPPTHalfOpacity.IsChecked = bopsc[1] == '2';
|
||||
if (CheckboxBPPTBlackBackground != null) CheckboxBPPTBlackBackground.IsChecked = bopsc[2] == '2';
|
||||
}
|
||||
|
||||
// 按钮透明度
|
||||
if (PPTLSButtonOpacityValueSlider != null)
|
||||
{
|
||||
PPTLSButtonOpacityValueSlider.Value = pptSettings.PPTLSButtonOpacity > 0 ? pptSettings.PPTLSButtonOpacity : 0.5;
|
||||
if (PPTLSButtonOpacityValueText != null)
|
||||
{
|
||||
PPTLSButtonOpacityValueText.Text = PPTLSButtonOpacityValueSlider.Value.ToString("F1");
|
||||
}
|
||||
}
|
||||
if (PPTRSButtonOpacityValueSlider != null)
|
||||
{
|
||||
PPTRSButtonOpacityValueSlider.Value = pptSettings.PPTRSButtonOpacity > 0 ? pptSettings.PPTRSButtonOpacity : 0.5;
|
||||
if (PPTRSButtonOpacityValueText != null)
|
||||
{
|
||||
PPTRSButtonOpacityValueText.Text = PPTRSButtonOpacityValueSlider.Value.ToString("F1");
|
||||
}
|
||||
}
|
||||
if (PPTLBButtonOpacityValueSlider != null)
|
||||
{
|
||||
PPTLBButtonOpacityValueSlider.Value = pptSettings.PPTLBButtonOpacity > 0 ? pptSettings.PPTLBButtonOpacity : 0.5;
|
||||
if (PPTLBButtonOpacityValueText != null)
|
||||
{
|
||||
PPTLBButtonOpacityValueText.Text = PPTLBButtonOpacityValueSlider.Value.ToString("F1");
|
||||
}
|
||||
}
|
||||
if (PPTRBButtonOpacityValueSlider != null)
|
||||
{
|
||||
PPTRBButtonOpacityValueSlider.Value = pptSettings.PPTRBButtonOpacity > 0 ? pptSettings.PPTRBButtonOpacity : 0.5;
|
||||
if (PPTRBButtonOpacityValueText != null)
|
||||
{
|
||||
PPTRBButtonOpacityValueText.Text = PPTRBButtonOpacityValueSlider.Value.ToString("F1");
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
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))
|
||||
: new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var innerBorder = toggleSwitch.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
innerBorder.HorizontalAlignment = isOn ? HorizontalAlignment.Right : HorizontalAlignment.Left;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置选项按钮状态
|
||||
/// </summary>
|
||||
private void SetOptionButtonState(string group, int selectedIndex)
|
||||
{
|
||||
var buttons = new Dictionary<string, string[]>
|
||||
{
|
||||
{ "PPTTimeCapsulePosition", new[] { "TopLeft", "TopRight", "TopCenter" } }
|
||||
};
|
||||
|
||||
if (!buttons.ContainsKey(group)) return;
|
||||
|
||||
string[] buttonNames = buttons[group];
|
||||
|
||||
for (int i = 0; i < buttonNames.Length; i++)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ToggleSwitch点击事件处理
|
||||
/// </summary>
|
||||
private void ToggleSwitch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
bool isOn = border.Background.ToString() == "#FF3584E4";
|
||||
bool newState = !isOn;
|
||||
SetToggleSwitchState(border, newState);
|
||||
|
||||
string tag = border.Tag?.ToString();
|
||||
if (string.IsNullOrEmpty(tag)) return;
|
||||
|
||||
var pptSettings = MainWindow.Settings.PowerPointSettings;
|
||||
if (pptSettings == null) return;
|
||||
|
||||
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;
|
||||
}
|
||||
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;
|
||||
|
||||
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 + "_"))
|
||||
{
|
||||
childBorder.Background = new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = childBorder.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 设置当前按钮为选中状态
|
||||
border.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var currentTextBlock = border.Child as TextBlock;
|
||||
if (currentTextBlock != null)
|
||||
{
|
||||
currentTextBlock.FontWeight = FontWeights.Bold;
|
||||
}
|
||||
|
||||
var pptSettings = MainWindow.Settings.PowerPointSettings;
|
||||
if (pptSettings == null) return;
|
||||
|
||||
switch (group)
|
||||
{
|
||||
case "PPTTimeCapsulePosition":
|
||||
int position;
|
||||
switch (value)
|
||||
{
|
||||
case "TopLeft":
|
||||
position = 0;
|
||||
break;
|
||||
case "TopRight":
|
||||
position = 1;
|
||||
break;
|
||||
case "TopCenter":
|
||||
position = 2;
|
||||
break;
|
||||
default:
|
||||
position = 1;
|
||||
break;
|
||||
}
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
pptSettings.PPTTimeCapsulePosition = position;
|
||||
}, "PPTTimeCapsulePosition");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// CheckBox变化事件处理
|
||||
/// </summary>
|
||||
private void CheckBox_CheckedChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
var checkBox = sender as CheckBox;
|
||||
if (checkBox == null) return;
|
||||
|
||||
string name = checkBox.Name;
|
||||
var pptSettings = MainWindow.Settings.PowerPointSettings;
|
||||
if (pptSettings == null) return;
|
||||
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeCheckBoxCheckedChanged(name, checkBox.IsChecked ?? false);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Slider值变化事件处理
|
||||
/// </summary>
|
||||
private void PPTButtonPositionSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
var slider = sender as Slider;
|
||||
if (slider == null) return;
|
||||
|
||||
string name = slider.Name;
|
||||
double value = slider.Value;
|
||||
|
||||
// 更新文本显示
|
||||
switch (name)
|
||||
{
|
||||
case "PPTButtonLeftPositionValueSlider":
|
||||
if (PPTButtonLeftPositionValueText != null)
|
||||
{
|
||||
PPTButtonLeftPositionValueText.Text = ((int)value).ToString();
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("PPTButtonLeftPositionValueSlider", value);
|
||||
break;
|
||||
|
||||
case "PPTButtonRightPositionValueSlider":
|
||||
if (PPTButtonRightPositionValueText != null)
|
||||
{
|
||||
PPTButtonRightPositionValueText.Text = ((int)value).ToString();
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("PPTButtonRightPositionValueSlider", value);
|
||||
break;
|
||||
|
||||
case "PPTButtonLBPositionValueSlider":
|
||||
if (PPTButtonLBPositionValueText != null)
|
||||
{
|
||||
PPTButtonLBPositionValueText.Text = ((int)value).ToString();
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("PPTButtonLBPositionValueSlider", value);
|
||||
break;
|
||||
|
||||
case "PPTButtonRBPositionValueSlider":
|
||||
if (PPTButtonRBPositionValueText != null)
|
||||
{
|
||||
PPTButtonRBPositionValueText.Text = ((int)value).ToString();
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("PPTButtonRBPositionValueSlider", value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按钮透明度Slider值变化事件处理
|
||||
/// </summary>
|
||||
private void PPTButtonOpacitySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
var slider = sender as Slider;
|
||||
if (slider == null) return;
|
||||
|
||||
string name = slider.Name;
|
||||
double value = slider.Value;
|
||||
|
||||
// 更新文本显示
|
||||
switch (name)
|
||||
{
|
||||
case "PPTLSButtonOpacityValueSlider":
|
||||
if (PPTLSButtonOpacityValueText != null)
|
||||
{
|
||||
PPTLSButtonOpacityValueText.Text = value.ToString("F1");
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("PPTLSButtonOpacityValueSlider", value);
|
||||
break;
|
||||
|
||||
case "PPTRSButtonOpacityValueSlider":
|
||||
if (PPTRSButtonOpacityValueText != null)
|
||||
{
|
||||
PPTRSButtonOpacityValueText.Text = value.ToString("F1");
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("PPTRSButtonOpacityValueSlider", value);
|
||||
break;
|
||||
|
||||
case "PPTLBButtonOpacityValueSlider":
|
||||
if (PPTLBButtonOpacityValueText != null)
|
||||
{
|
||||
PPTLBButtonOpacityValueText.Text = value.ToString("F1");
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("PPTLBButtonOpacityValueSlider", value);
|
||||
break;
|
||||
|
||||
case "PPTRBButtonOpacityValueSlider":
|
||||
if (PPTRBButtonOpacityValueText != null)
|
||||
{
|
||||
PPTRBButtonOpacityValueText.Text = value.ToString("F1");
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("PPTRBButtonOpacityValueSlider", value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"PowerPointPanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
xmlns:local="clr-namespace:Ink_Canvas.Windows.SettingsViews"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="691" d:DesignWidth="910">
|
||||
<Grid Background="#fafafa" Margin="250,0,0,0">
|
||||
<Grid x:Name="SearchPanelMainGrid" Background="#fafafa" Margin="250,0,0,0">
|
||||
<!-- 搜索框区域 -->
|
||||
<Grid Height="48" VerticalAlignment="Top" Margin="0,0,0,0">
|
||||
<Border Height="48" CornerRadius="0,6,0,0" Background="#fafafa">
|
||||
<Border x:Name="SearchPanelTopBarBorder" Height="48" CornerRadius="0,6,0,0" Background="#fafafa">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Direction="-90" ShadowDepth="3" BlurRadius="4" Color="#000000" Opacity="0.25"/>
|
||||
</Border.Effect>
|
||||
@@ -20,7 +20,7 @@
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<!-- 搜索输入框 -->
|
||||
<Border Grid.Column="0" Margin="60,8,12,8" Background="White" CornerRadius="8" BorderBrush="#e6e6e6" BorderThickness="1">
|
||||
<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">
|
||||
<Image.Source>
|
||||
@@ -67,7 +67,7 @@
|
||||
<StackPanel Margin="60,12,60,24" Name="SearchResultsPanel">
|
||||
<!-- 精准和拼音匹配结果 -->
|
||||
<StackPanel Name="ExactMatchPanel" Visibility="Collapsed">
|
||||
<TextBlock Text="精准匹配" FontSize="13" FontWeight="Bold" Foreground="#2e3436" Margin="0,0,0,8"/>
|
||||
<TextBlock x:Name="ExactMatchTitle" Text="精准匹配" FontSize="13" FontWeight="Bold" Foreground="#2e3436" Margin="0,0,0,8"/>
|
||||
<ItemsControl Name="ExactMatchItemsControl">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
@@ -87,7 +87,7 @@
|
||||
|
||||
<!-- 模糊匹配结果 -->
|
||||
<StackPanel Name="FuzzyMatchPanel" Visibility="Collapsed" Margin="0,16,0,0">
|
||||
<TextBlock Text="模糊匹配" FontSize="13" FontWeight="Bold" Foreground="#2e3436" Margin="0,0,0,8"/>
|
||||
<TextBlock x:Name="FuzzyMatchTitle" Text="模糊匹配" FontSize="13" FontWeight="Bold" Foreground="#2e3436" Margin="0,0,0,8"/>
|
||||
<ItemsControl Name="FuzzyMatchItemsControl">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
@@ -107,7 +107,7 @@
|
||||
|
||||
<!-- 相关项结果 -->
|
||||
<StackPanel Name="RelatedItemsPanel" Visibility="Collapsed" Margin="0,16,0,0">
|
||||
<TextBlock Text="相关项" FontSize="13" FontWeight="Bold" Foreground="#2e3436" Margin="0,0,0,8"/>
|
||||
<TextBlock x:Name="RelatedItemsTitle" Text="相关项" FontSize="13" FontWeight="Bold" Foreground="#2e3436" Margin="0,0,0,8"/>
|
||||
<ItemsControl Name="RelatedItemsControl">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
|
||||
@@ -380,6 +380,196 @@ 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();
|
||||
}
|
||||
if (FuzzyMatchTitle != null)
|
||||
{
|
||||
FuzzyMatchTitle.Foreground = ThemeHelper.GetTextPrimaryBrush();
|
||||
}
|
||||
if (RelatedItemsTitle != null)
|
||||
{
|
||||
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}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新搜索框中的图标颜色
|
||||
/// </summary>
|
||||
private void UpdateSearchIconColor(bool isDarkTheme)
|
||||
{
|
||||
try
|
||||
{
|
||||
Color iconColor = isDarkTheme
|
||||
? Color.FromRgb(243, 243, 243) // 深色主题使用浅色图标 #F3F3F3
|
||||
: Color.FromRgb(34, 34, 34); // 浅色主题使用深色图标 #222222
|
||||
|
||||
// 查找搜索输入框中的图标
|
||||
if (SearchInputBorder != null)
|
||||
{
|
||||
var image = FindVisualChild<Image>(SearchInputBorder);
|
||||
if (image != null && image.Source is DrawingImage drawingImage)
|
||||
{
|
||||
if (drawingImage.Drawing is DrawingGroup drawingGroup)
|
||||
{
|
||||
var clonedDrawing = CloneDrawingGroup(drawingGroup, iconColor);
|
||||
image.Source = new DrawingImage { Drawing = clonedDrawing };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"更新搜索图标颜色时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 克隆 DrawingGroup 并更新颜色
|
||||
/// </summary>
|
||||
private DrawingGroup CloneDrawingGroup(DrawingGroup source, Color newColor)
|
||||
{
|
||||
var cloned = new DrawingGroup();
|
||||
cloned.ClipGeometry = source.ClipGeometry?.Clone();
|
||||
cloned.Opacity = source.Opacity;
|
||||
cloned.Transform = source.Transform?.Clone();
|
||||
|
||||
foreach (var drawing in source.Children)
|
||||
{
|
||||
if (drawing is GeometryDrawing geometryDrawing)
|
||||
{
|
||||
var clonedGeometry = geometryDrawing.Geometry?.Clone();
|
||||
var clonedBrush = CloneBrush(geometryDrawing.Brush, newColor);
|
||||
var clonedPen = geometryDrawing.Pen != null
|
||||
? ClonePen(geometryDrawing.Pen, newColor)
|
||||
: null;
|
||||
|
||||
cloned.Children.Add(new GeometryDrawing(clonedBrush, clonedPen, clonedGeometry));
|
||||
}
|
||||
else if (drawing is DrawingGroup subGroup)
|
||||
{
|
||||
cloned.Children.Add(CloneDrawingGroup(subGroup, newColor));
|
||||
}
|
||||
else
|
||||
{
|
||||
cloned.Children.Add(drawing);
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
return new SolidColorBrush(newColor) { Opacity = solidBrush.Opacity };
|
||||
}
|
||||
else if (originalColor.A > 0 && originalColor != Colors.Transparent &&
|
||||
originalColor.R < 50 && originalColor.G < 50 && originalColor.B < 50) // 深色
|
||||
{
|
||||
return new SolidColorBrush(newColor) { Opacity = solidBrush.Opacity };
|
||||
}
|
||||
return new SolidColorBrush(originalColor) { Opacity = solidBrush.Opacity };
|
||||
}
|
||||
return source?.Clone();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 克隆 Pen 并更新颜色
|
||||
/// </summary>
|
||||
private Pen ClonePen(Pen source, Color newColor)
|
||||
{
|
||||
var clonedBrush = CloneBrush(source.Brush, newColor);
|
||||
return new Pen(clonedBrush, source.Thickness)
|
||||
{
|
||||
StartLineCap = source.StartLineCap,
|
||||
EndLineCap = source.EndLineCap,
|
||||
LineJoin = source.LineJoin,
|
||||
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++)
|
||||
{
|
||||
var child = System.Windows.Media.VisualTreeHelper.GetChild(parent, i);
|
||||
if (child is T result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
var childOfChild = FindVisualChild<T>(child);
|
||||
if (childOfChild != null)
|
||||
{
|
||||
return childOfChild;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public class SettingItem
|
||||
|
||||
@@ -0,0 +1,273 @@
|
||||
using Ink_Canvas;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
/// <summary>
|
||||
/// 设置面板基类,提供通用的辅助方法
|
||||
/// </summary>
|
||||
public abstract class SettingsPanelBase : UserControl
|
||||
{
|
||||
protected bool _isLoaded = false;
|
||||
|
||||
public SettingsPanelBase()
|
||||
{
|
||||
Loaded += SettingsPanelBase_Loaded;
|
||||
}
|
||||
|
||||
private void SettingsPanelBase_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LoadSettings();
|
||||
// 添加触摸支持
|
||||
EnableTouchSupport();
|
||||
// 应用主题(如果面板有 ApplyTheme 方法)
|
||||
try
|
||||
{
|
||||
var applyThemeMethod = this.GetType().GetMethod("ApplyTheme",
|
||||
System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
|
||||
if (applyThemeMethod != null)
|
||||
{
|
||||
applyThemeMethod.Invoke(this, null);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"SettingsPanelBase 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为面板中的所有交互控件启用触摸支持
|
||||
/// </summary>
|
||||
protected virtual void EnableTouchSupport()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 延迟执行,确保所有控件都已加载
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
EnableTouchSupportForControls(this);
|
||||
}), System.Windows.Threading.DispatcherPriority.Loaded);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"启用触摸支持时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为控件树中的所有交互控件启用触摸支持
|
||||
/// </summary>
|
||||
private void EnableTouchSupportForControls(DependencyObject parent)
|
||||
{
|
||||
if (parent == null) return;
|
||||
|
||||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(parent); i++)
|
||||
{
|
||||
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))
|
||||
: new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var innerBorder = toggleSwitch.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
innerBorder.HorizontalAlignment = isOn ? HorizontalAlignment.Right : HorizontalAlignment.Left;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通用的ToggleSwitch点击事件处理
|
||||
/// </summary>
|
||||
protected virtual void ToggleSwitch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
bool isOn = border.Background.ToString() == "#FF3584E4";
|
||||
bool newState = !isOn;
|
||||
SetToggleSwitchState(border, newState);
|
||||
|
||||
string tag = border.Tag?.ToString();
|
||||
if (string.IsNullOrEmpty(tag)) return;
|
||||
|
||||
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;
|
||||
|
||||
string[] parts = tag.Split('_');
|
||||
if (parts.Length >= 2)
|
||||
{
|
||||
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 + "_"))
|
||||
{
|
||||
childBorder.Background = new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = childBorder.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 设置当前按钮为选中状态
|
||||
border.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var currentTextBlock = border.Child as TextBlock;
|
||||
if (currentTextBlock != null)
|
||||
{
|
||||
currentTextBlock.FontWeight = FontWeights.Bold;
|
||||
}
|
||||
|
||||
HandleOptionChange(group, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理选项变化 - 子类需要实现
|
||||
/// </summary>
|
||||
protected abstract void HandleOptionChange(string group, string value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,21 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"ShortcutsPanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<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="ToggleSwitchAutoSaveStrokesAtClear" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -50,7 +50,7 @@
|
||||
<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="ToggleSwitchSaveScreenshotsInDateFolders" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -64,7 +64,7 @@
|
||||
<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="ToggleSwitchAutoSaveStrokesAtScreenshot" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -78,7 +78,7 @@
|
||||
<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="ToggleSwitchAutoSaveScreenShotInPowerPoint" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -93,7 +93,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="设置自动截图时所需的最小墨迹量" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="SideControlMinimumAutomationSlider" Width="150" Minimum="0.3" Maximum="1" Value="1" TickFrequency="0.05" IsSnapToTickEnabled="True"/>
|
||||
<Slider x:Name="SideControlMinimumAutomationSlider" Width="150" Minimum="0.3" Maximum="1" Value="1" TickFrequency="0.05" IsSnapToTickEnabled="True" ValueChanged="SideControlMinimumAutomationSlider_ValueChanged"/>
|
||||
<TextBlock x:Name="SideControlMinimumAutomationText" Text="1.00" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436" FontFamily="Consolas"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
@@ -107,12 +107,12 @@
|
||||
<StackPanel Orientation="Vertical" Margin="0,8,0,0">
|
||||
<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"/>
|
||||
<Button x:Name="AutoSavedStrokesLocationButton" Content="浏览" Padding="12,6" Margin="8,0,0,0" Background="#2563eb" Foreground="White"/>
|
||||
<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"/>
|
||||
</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"/>
|
||||
<Button x:Name="SetAutoSavedStrokesLocationToDocumentFolderButton" Content="设置保存到 文档" Padding="12,6" Background="#2563eb" Foreground="White"/>
|
||||
<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"/>
|
||||
</StackPanel>
|
||||
<TextBlock Text="请注意检查保存文件夹是否有写入权限" TextWrapping="Wrap" Foreground="#9a9996" FontSize="11"/>
|
||||
</StackPanel>
|
||||
@@ -128,7 +128,7 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="定期自动删除超过保存时间的墨迹、截图文件" HorizontalAlignment="Left"/>
|
||||
<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">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -147,7 +147,8 @@
|
||||
ItemContainerStyle="{StaticResource ComboBoxItemStyle}"
|
||||
HorizontalAlignment="Left"
|
||||
Width="150"
|
||||
SelectedIndex="4">
|
||||
SelectedIndex="4"
|
||||
SelectionChanged="ComboBoxAutoDelSavedFilesDaysThreshold_SelectionChanged">
|
||||
<ComboBoxItem Content="1天" Tag="AutoDelSavedFilesDaysThreshold_1"/>
|
||||
<ComboBoxItem Content="3天" Tag="AutoDelSavedFilesDaysThreshold_3"/>
|
||||
<ComboBoxItem Content="5天" Tag="AutoDelSavedFilesDaysThreshold_5"/>
|
||||
|
||||
@@ -1,17 +1,54 @@
|
||||
using Ink_Canvas;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using Application = System.Windows.Application;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
/// <summary>
|
||||
/// SnapshotPanel.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class SnapshotPanel : UserControl
|
||||
public partial class SnapshotPanel : System.Windows.Controls.UserControl
|
||||
{
|
||||
private bool _isLoaded = false;
|
||||
|
||||
public SnapshotPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += SnapshotPanel_Loaded;
|
||||
}
|
||||
|
||||
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);
|
||||
}), System.Windows.Threading.DispatcherPriority.Loaded);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"SnapshotPanel 启用触摸支持时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<RoutedEventArgs> IsTopBarNeedShadowEffect;
|
||||
@@ -29,6 +66,311 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载设置到UI
|
||||
/// </summary>
|
||||
public void LoadSettings()
|
||||
{
|
||||
if (MainWindow.Settings == null) return;
|
||||
|
||||
_isLoaded = false;
|
||||
|
||||
try
|
||||
{
|
||||
// 清屏时自动截图
|
||||
if (MainWindow.Settings.Automation != null)
|
||||
{
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAutoSaveStrokesAtClear"), MainWindow.Settings.Automation.IsAutoSaveStrokesAtClear);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchSaveScreenshotsInDateFolders"), MainWindow.Settings.Automation.IsSaveScreenshotsInDateFolders);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAutoSaveStrokesAtScreenshot"), MainWindow.Settings.Automation.IsAutoSaveStrokesAtScreenshot);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAutoDelSavedFiles"), MainWindow.Settings.Automation.AutoDelSavedFiles);
|
||||
|
||||
// 自动截图最小墨迹量
|
||||
if (SideControlMinimumAutomationSlider != null)
|
||||
{
|
||||
double minValue = MainWindow.Settings.Automation.MinimumAutomationStrokeNumber;
|
||||
if (minValue == 0) minValue = 1.0;
|
||||
SideControlMinimumAutomationSlider.Value = minValue;
|
||||
if (SideControlMinimumAutomationText != null)
|
||||
{
|
||||
SideControlMinimumAutomationText.Text = minValue.ToString("F2");
|
||||
}
|
||||
}
|
||||
|
||||
// 保存路径
|
||||
if (AutoSavedStrokesLocation != null)
|
||||
{
|
||||
AutoSavedStrokesLocation.Text = MainWindow.Settings.Automation.AutoSavedStrokesLocation;
|
||||
}
|
||||
|
||||
// 自动删除保存时长
|
||||
if (ComboBoxAutoDelSavedFilesDaysThreshold != null)
|
||||
{
|
||||
int days = MainWindow.Settings.Automation.AutoDelSavedFilesDaysThreshold;
|
||||
int selectedIndex = 4; // 默认15天
|
||||
switch (days)
|
||||
{
|
||||
case 1: selectedIndex = 0; break;
|
||||
case 3: selectedIndex = 1; break;
|
||||
case 5: selectedIndex = 2; break;
|
||||
case 7: selectedIndex = 3; break;
|
||||
case 15: selectedIndex = 4; break;
|
||||
case 30: selectedIndex = 5; break;
|
||||
case 60: selectedIndex = 6; break;
|
||||
case 100: selectedIndex = 7; break;
|
||||
case 365: selectedIndex = 8; break;
|
||||
}
|
||||
ComboBoxAutoDelSavedFilesDaysThreshold.SelectedIndex = selectedIndex;
|
||||
}
|
||||
|
||||
if (AutoDelIntervalPanel != null)
|
||||
{
|
||||
AutoDelIntervalPanel.Visibility = MainWindow.Settings.Automation.AutoDelSavedFiles ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
|
||||
// 自动幻灯片截屏
|
||||
if (MainWindow.Settings.PowerPointSettings != null)
|
||||
{
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAutoSaveScreenShotInPowerPoint"), MainWindow.Settings.PowerPointSettings.IsAutoSaveScreenShotInPowerPoint);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
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))
|
||||
: new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var innerBorder = toggleSwitch.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
innerBorder.HorizontalAlignment = isOn ? System.Windows.HorizontalAlignment.Right : System.Windows.HorizontalAlignment.Left;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ToggleSwitch点击事件处理
|
||||
/// </summary>
|
||||
private void ToggleSwitch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
bool isOn = border.Background.ToString() == "#FF3584E4";
|
||||
bool newState = !isOn;
|
||||
SetToggleSwitchState(border, newState);
|
||||
|
||||
string tag = border.Tag?.ToString();
|
||||
if (string.IsNullOrEmpty(tag)) return;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Slider值变化事件处理
|
||||
/// </summary>
|
||||
private void SideControlMinimumAutomationSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
if (SideControlMinimumAutomationSlider != null && SideControlMinimumAutomationText != null)
|
||||
{
|
||||
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;
|
||||
if (mainWindow != null)
|
||||
{
|
||||
var textBox = mainWindow.FindName("AutoSavedStrokesLocation") as System.Windows.Controls.TextBox;
|
||||
if (textBox != null)
|
||||
{
|
||||
AutoSavedStrokesLocation.Text = textBox.Text;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <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;
|
||||
if (mainWindow != null)
|
||||
{
|
||||
var textBox = mainWindow.FindName("AutoSavedStrokesLocation") as System.Windows.Controls.TextBox;
|
||||
if (textBox != null)
|
||||
{
|
||||
AutoSavedStrokesLocation.Text = textBox.Text;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置保存到文档按钮点击事件处理
|
||||
/// </summary>
|
||||
private void SetAutoSavedStrokesLocationToDocumentFolderButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (AutoSavedStrokesLocation != null)
|
||||
{
|
||||
string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
|
||||
AutoSavedStrokesLocation.Text = Path.Combine(documentsPath, "Ink Canvas");
|
||||
}
|
||||
}
|
||||
|
||||
/// <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_"))
|
||||
{
|
||||
string daysStr = tag.Replace("AutoDelSavedFilesDaysThreshold_", "");
|
||||
foreach (ComboBoxItem item in comboBox.Items)
|
||||
{
|
||||
if (item.Tag?.ToString() == tag || item.Content?.ToString() == daysStr + "天")
|
||||
{
|
||||
comboBox.SelectedItem = item;
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChanged("ComboBoxAutoDelSavedFilesDaysThreshold", item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置
|
||||
string tag = selectedItem.Tag?.ToString();
|
||||
if (!string.IsNullOrEmpty(tag) && tag.StartsWith("AutoDelSavedFilesDaysThreshold_"))
|
||||
{
|
||||
string daysStr = tag.Replace("AutoDelSavedFilesDaysThreshold_", "");
|
||||
if (int.TryParse(daysStr, out int days))
|
||||
{
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
if (MainWindow.Settings.Automation != null)
|
||||
{
|
||||
MainWindow.Settings.Automation.AutoDelSavedFilesDaysThreshold = days;
|
||||
}
|
||||
}, "ComboBoxAutoDelSavedFilesDaysThreshold");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"SnapshotPanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<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="ToggleSwitchNoFocusMode" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -49,7 +49,7 @@
|
||||
<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="ToggleSwitchWindowMode" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -63,7 +63,7 @@
|
||||
<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="ToggleSwitchAlwaysOnTop" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -77,7 +77,7 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="UIA置顶" HorizontalAlignment="Left"/>
|
||||
<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">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -96,7 +96,7 @@
|
||||
<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="ToggleSwitchIsAutoUpdate" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -110,7 +110,7 @@
|
||||
<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="ToggleSwitchIsAutoUpdateWithSilence" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -125,10 +125,10 @@
|
||||
<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">
|
||||
<Border x:Name="UpdateChannelReleaseBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" 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">
|
||||
<Border x:Name="UpdateChannelBetaBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="UpdateChannel_Beta" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="测试版"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
@@ -139,7 +139,7 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="手动更新" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="点击后立即检查并下载最新版本" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Button x:Name="ManualUpdateButton" Content="手动更新" Width="120" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" Padding="12,6"/>
|
||||
<Button x:Name="ManualUpdateButton" Content="手动更新" Width="120" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" Padding="12,6" Click="ManualUpdateButton_Click"/>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
@@ -147,7 +147,7 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="版本修复" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="根据当前选择的通道下载最新版本并执行安装,可用于修复损坏的安装" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Button x:Name="FixVersionButton" Content="版本修复" Width="120" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" Padding="12,6"/>
|
||||
<Button x:Name="FixVersionButton" Content="版本修复" Width="120" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" Padding="12,6" Click="FixVersionButton_Click"/>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
@@ -155,7 +155,7 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="历史版本回滚" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="回滚到之前的版本" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Button x:Name="HistoryRollbackButton" Content="历史版本回滚" Width="120" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" Padding="12,6"/>
|
||||
<Button x:Name="HistoryRollbackButton" Content="历史版本回滚" Width="120" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" Padding="12,6" Click="HistoryRollbackButton_Click"/>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Margin="18,12,15,12" x:Name="AutoUpdateTimePeriodBlock">
|
||||
@@ -169,7 +169,8 @@
|
||||
ItemContainerStyle="{StaticResource ComboBoxItemStyle}"
|
||||
HorizontalAlignment="Left"
|
||||
Width="150"
|
||||
SelectedIndex="6">
|
||||
SelectedIndex="6"
|
||||
SelectionChanged="AutoUpdateWithSilenceStartTimeComboBox_SelectionChanged">
|
||||
<ComboBoxItem Content="00:00" Tag="00"/>
|
||||
<ComboBoxItem Content="01:00" Tag="01"/>
|
||||
<ComboBoxItem Content="02:00" Tag="02"/>
|
||||
@@ -203,7 +204,8 @@
|
||||
ItemContainerStyle="{StaticResource ComboBoxItemStyle}"
|
||||
HorizontalAlignment="Left"
|
||||
Width="150"
|
||||
SelectedIndex="22">
|
||||
SelectedIndex="22"
|
||||
SelectionChanged="AutoUpdateWithSilenceEndTimeComboBox_SelectionChanged">
|
||||
<ComboBoxItem Content="00:00" Tag="00"/>
|
||||
<ComboBoxItem Content="01:00" Tag="01"/>
|
||||
<ComboBoxItem Content="02:00" Tag="02"/>
|
||||
@@ -246,7 +248,7 @@
|
||||
<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="ToggleSwitchRunAtStartup" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -260,7 +262,7 @@
|
||||
<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="ToggleSwitchFoldAtStartup" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -281,7 +283,7 @@
|
||||
<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="ToggleSwitchMode" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1">
|
||||
<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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
using Ink_Canvas;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
@@ -9,9 +13,50 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
/// </summary>
|
||||
public partial class StartupPanel : UserControl
|
||||
{
|
||||
private bool _isLoaded = false;
|
||||
|
||||
public StartupPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += StartupPanel_Loaded;
|
||||
}
|
||||
|
||||
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);
|
||||
}), System.Windows.Threading.DispatcherPriority.Loaded);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"StartupPanel 启用触摸支持时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为控件树中的所有交互控件启用触摸支持
|
||||
/// </summary>
|
||||
private void EnableTouchSupportForControls(System.Windows.DependencyObject parent)
|
||||
{
|
||||
// 使用 MainWindowSettingsHelper 的通用方法
|
||||
MainWindowSettingsHelper.EnableTouchSupportForControls(parent);
|
||||
}
|
||||
|
||||
public event EventHandler<RoutedEventArgs> IsTopBarNeedShadowEffect;
|
||||
@@ -29,6 +74,447 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载设置到UI
|
||||
/// </summary>
|
||||
public void LoadSettings()
|
||||
{
|
||||
if (MainWindow.Settings == null) return;
|
||||
|
||||
_isLoaded = false;
|
||||
|
||||
try
|
||||
{
|
||||
// 自动更新设置
|
||||
var toggleSwitchIsAutoUpdate = FindToggleSwitch("ToggleSwitchIsAutoUpdate");
|
||||
if (toggleSwitchIsAutoUpdate != null)
|
||||
{
|
||||
bool isAutoUpdate = MainWindow.Settings.Startup.IsAutoUpdate;
|
||||
SetToggleSwitchState(toggleSwitchIsAutoUpdate, isAutoUpdate);
|
||||
}
|
||||
|
||||
// 静默更新设置
|
||||
var toggleSwitchIsAutoUpdateWithSilence = FindToggleSwitch("ToggleSwitchIsAutoUpdateWithSilence");
|
||||
if (toggleSwitchIsAutoUpdateWithSilence != null)
|
||||
{
|
||||
bool isAutoUpdateWithSilence = MainWindow.Settings.Startup.IsAutoUpdateWithSilence;
|
||||
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>()
|
||||
.FirstOrDefault(item => item.Tag?.ToString() == startTime.Replace(":", ""));
|
||||
if (startItem != null)
|
||||
{
|
||||
AutoUpdateWithSilenceStartTimeComboBox.SelectedItem = startItem;
|
||||
}
|
||||
}
|
||||
|
||||
if (AutoUpdateWithSilenceEndTimeComboBox != null)
|
||||
{
|
||||
var endTime = MainWindow.Settings.Startup.AutoUpdateWithSilenceEndTime ?? "22:00";
|
||||
var endItem = AutoUpdateWithSilenceEndTimeComboBox.Items.Cast<ComboBoxItem>()
|
||||
.FirstOrDefault(item => item.Tag?.ToString() == endTime.Replace(":", ""));
|
||||
if (endItem != null)
|
||||
{
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateUpdateChannelButtons(false);
|
||||
}
|
||||
|
||||
// 仅PPT模式
|
||||
var toggleSwitchMode = FindToggleSwitch("ToggleSwitchMode");
|
||||
if (toggleSwitchMode != null && MainWindow.Settings.ModeSettings != null)
|
||||
{
|
||||
SetToggleSwitchState(toggleSwitchMode, MainWindow.Settings.ModeSettings.IsPPTOnlyMode);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
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)) : new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
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;
|
||||
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
bool isOn = border.Background.ToString() == "#FF3584E4";
|
||||
bool newState = !isOn;
|
||||
SetToggleSwitchState(border, newState);
|
||||
|
||||
string tag = border.Tag?.ToString();
|
||||
if (string.IsNullOrEmpty(tag)) return;
|
||||
|
||||
switch (tag)
|
||||
{
|
||||
case "IsAutoUpdate":
|
||||
// 直接调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchIsAutoUpdate", newState);
|
||||
// 更新UI状态
|
||||
var toggleSwitchIsAutoUpdateWithSilence = FindToggleSwitch("ToggleSwitchIsAutoUpdateWithSilence");
|
||||
if (toggleSwitchIsAutoUpdateWithSilence != null)
|
||||
{
|
||||
toggleSwitchIsAutoUpdateWithSilence.Visibility = newState ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
if (AutoUpdateTimePeriodBlock != null)
|
||||
{
|
||||
AutoUpdateTimePeriodBlock.Visibility =
|
||||
(MainWindow.Settings.Startup.IsAutoUpdateWithSilence && MainWindow.Settings.Startup.IsAutoUpdate) ?
|
||||
Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
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)
|
||||
{
|
||||
MainWindow.Settings.Advanced.IsNoFocusMode = newState;
|
||||
}
|
||||
}, "ToggleSwitchNoFocusMode");
|
||||
// 调用 ApplyNoFocusMode 方法
|
||||
MainWindowSettingsHelper.InvokeMainWindowMethod("ApplyNoFocusMode");
|
||||
break;
|
||||
|
||||
case "WindowMode":
|
||||
// 窗口无边框模式
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchWindowMode", newState);
|
||||
break;
|
||||
|
||||
case "AlwaysOnTop":
|
||||
// 窗口置顶
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
if (MainWindow.Settings.Advanced != null)
|
||||
{
|
||||
MainWindow.Settings.Advanced.IsAlwaysOnTop = newState;
|
||||
}
|
||||
}, "ToggleSwitchAlwaysOnTop");
|
||||
// 调用 SetAlwaysOnTop 方法(如果存在)
|
||||
MainWindowSettingsHelper.InvokeMainWindowMethod("SetAlwaysOnTop", newState);
|
||||
break;
|
||||
|
||||
case "UIAccessTopMost":
|
||||
// UIA置顶
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
if (MainWindow.Settings.Advanced != null)
|
||||
{
|
||||
MainWindow.Settings.Advanced.EnableUIAccessTopMost = newState;
|
||||
}
|
||||
}, "ToggleSwitchUIAccessTopMost");
|
||||
break;
|
||||
|
||||
case "Mode":
|
||||
// 仅PPT模式
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchMode", newState);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选项按钮点击事件处理
|
||||
/// </summary>
|
||||
private void OptionButton_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;
|
||||
|
||||
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);
|
||||
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);
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
if (UpdateChannelBetaBorder != null)
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
// 更新按钮
|
||||
if (ManualUpdateButton != null)
|
||||
{
|
||||
ManualUpdateButton.Background = ThemeHelper.GetButtonBackgroundBrush();
|
||||
ManualUpdateButton.Foreground = ThemeHelper.GetTextPrimaryBrush();
|
||||
}
|
||||
if (FixVersionButton != null)
|
||||
{
|
||||
FixVersionButton.Background = ThemeHelper.GetButtonBackgroundBrush();
|
||||
FixVersionButton.Foreground = ThemeHelper.GetTextPrimaryBrush();
|
||||
}
|
||||
if (HistoryRollbackButton != null)
|
||||
{
|
||||
HistoryRollbackButton.Background = ThemeHelper.GetButtonBackgroundBrush();
|
||||
HistoryRollbackButton.Foreground = ThemeHelper.GetTextPrimaryBrush();
|
||||
}
|
||||
|
||||
// 使用 ThemeHelper 递归更新其他元素
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"StartupPanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,21 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"StoragePanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,470 @@
|
||||
using System.Windows.Media;
|
||||
using Ink_Canvas;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
/// <summary>
|
||||
/// 主题辅助类:提供统一的主题颜色资源
|
||||
/// </summary>
|
||||
public static class ThemeHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 检查当前是否为深色主题
|
||||
/// </summary>
|
||||
public static bool IsDarkTheme
|
||||
{
|
||||
get
|
||||
{
|
||||
if (MainWindow.Settings?.Appearance == null) return false;
|
||||
return MainWindow.Settings.Appearance.Theme == 1 ||
|
||||
(MainWindow.Settings.Appearance.Theme == 2 && !IsSystemThemeLight());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查系统主题是否为浅色
|
||||
/// </summary>
|
||||
private static bool IsSystemThemeLight()
|
||||
{
|
||||
try
|
||||
{
|
||||
var registryKey = Microsoft.Win32.Registry.CurrentUser;
|
||||
var themeKey = registryKey.OpenSubKey("software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize");
|
||||
var keyValue = 0;
|
||||
if (themeKey != null) keyValue = (int)themeKey.GetValue("SystemUsesLightTheme");
|
||||
return keyValue == 1;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return true; // 默认返回浅色主题
|
||||
}
|
||||
}
|
||||
|
||||
// 文字颜色 - 参考 Windows 系统设置
|
||||
public static Color TextPrimary => IsDarkTheme ? Color.FromRgb(243, 243, 243) : Color.FromRgb(0, 0, 0); // Windows 系统主文字颜色
|
||||
public static Color TextSecondary => IsDarkTheme ? Color.FromRgb(200, 200, 200) : Color.FromRgb(96, 96, 96); // Windows 系统次要文字颜色
|
||||
public static Color TextTertiary => IsDarkTheme ? Color.FromRgb(161, 161, 161) : Color.FromRgb(120, 120, 120); // Windows 系统三级文字颜色
|
||||
|
||||
// 背景颜色 - 参考 Windows 系统设置
|
||||
public static Color BackgroundPrimary => IsDarkTheme ? Color.FromRgb(32, 32, 32) : Color.FromRgb(255, 255, 255); // Windows 系统主背景
|
||||
public static Color BackgroundSecondary => IsDarkTheme ? Color.FromRgb(25, 25, 25) : Color.FromRgb(243, 243, 243); // Windows 系统次要背景(侧边栏等)
|
||||
public static Color BackgroundTertiary => IsDarkTheme ? Color.FromRgb(43, 43, 43) : Color.FromRgb(237, 237, 237); // Windows 系统三级背景(按钮等)
|
||||
|
||||
// 边框颜色 - 参考 Windows 系统设置
|
||||
public static Color BorderPrimary => IsDarkTheme ? Color.FromRgb(62, 62, 62) : Color.FromRgb(229, 229, 229); // Windows 系统主边框
|
||||
public static Color BorderSecondary => IsDarkTheme ? Color.FromRgb(55, 55, 55) : Color.FromRgb(220, 220, 220); // Windows 系统次要边框
|
||||
public static Color BorderTertiary => IsDarkTheme ? Color.FromRgb(70, 70, 70) : Color.FromRgb(211, 211, 211); // Windows 系统三级边框
|
||||
|
||||
// 分隔线颜色 - 参考 Windows 系统设置
|
||||
public static Color Separator => IsDarkTheme ? Color.FromRgb(62, 62, 62) : Color.FromRgb(237, 237, 237); // Windows 系统分隔线
|
||||
|
||||
// 选中/高亮颜色 - 参考 Windows 系统设置
|
||||
public static Color SelectedBackground => IsDarkTheme ? Color.FromRgb(62, 62, 62) : Color.FromRgb(237, 237, 237); // Windows 系统选中背景
|
||||
public static Color HoverBackground => IsDarkTheme ? Color.FromRgb(43, 43, 43) : Color.FromRgb(243, 243, 243); // Windows 系统悬停背景
|
||||
|
||||
// 按钮颜色 - 参考 Windows 系统设置
|
||||
public static Color ButtonBackground => IsDarkTheme ? Color.FromRgb(43, 43, 43) : Color.FromRgb(237, 237, 237); // Windows 系统按钮背景
|
||||
public static Color ButtonHoverBackground => IsDarkTheme ? Color.FromRgb(55, 55, 55) : Color.FromRgb(220, 220, 220); // Windows 系统按钮悬停背景
|
||||
|
||||
// 文本框颜色 - 参考 Windows 系统设置
|
||||
public static Color TextBoxBackground => IsDarkTheme ? Color.FromRgb(43, 43, 43) : Color.FromRgb(255, 255, 255); // Windows 系统文本框背景
|
||||
public static Color TextBoxBorder => IsDarkTheme ? Color.FromRgb(62, 62, 62) : Color.FromRgb(229, 229, 229); // Windows 系统文本框边框
|
||||
|
||||
// 滚动条颜色 - 参考 Windows 系统设置
|
||||
public static Color ScrollBarTrack => IsDarkTheme ? Color.FromRgb(25, 25, 25) : Color.FromRgb(243, 243, 243); // Windows 系统滚动条轨道
|
||||
public static Color ScrollBarThumb => IsDarkTheme ? Color.FromRgb(122, 122, 122) : Color.FromRgb(191, 191, 191); // Windows 系统滚动条滑块
|
||||
public static Color ScrollBarThumbHover => IsDarkTheme ? Color.FromRgb(150, 150, 150) : Color.FromRgb(138, 138, 138); // Windows 系统滚动条滑块悬停
|
||||
|
||||
// 转换为 SolidColorBrush
|
||||
public static SolidColorBrush GetTextPrimaryBrush() => new SolidColorBrush(TextPrimary);
|
||||
public static SolidColorBrush GetTextSecondaryBrush() => new SolidColorBrush(TextSecondary);
|
||||
public static SolidColorBrush GetTextTertiaryBrush() => new SolidColorBrush(TextTertiary);
|
||||
public static SolidColorBrush GetBackgroundPrimaryBrush() => new SolidColorBrush(BackgroundPrimary);
|
||||
public static SolidColorBrush GetBackgroundSecondaryBrush() => new SolidColorBrush(BackgroundSecondary);
|
||||
public static SolidColorBrush GetBackgroundTertiaryBrush() => new SolidColorBrush(BackgroundTertiary);
|
||||
public static SolidColorBrush GetBorderPrimaryBrush() => new SolidColorBrush(BorderPrimary);
|
||||
public static SolidColorBrush GetBorderSecondaryBrush() => new SolidColorBrush(BorderSecondary);
|
||||
public static SolidColorBrush GetBorderTertiaryBrush() => new SolidColorBrush(BorderTertiary);
|
||||
public static SolidColorBrush GetSeparatorBrush() => new SolidColorBrush(Separator);
|
||||
public static SolidColorBrush GetSelectedBackgroundBrush() => new SolidColorBrush(SelectedBackground);
|
||||
public static SolidColorBrush GetHoverBackgroundBrush() => new SolidColorBrush(HoverBackground);
|
||||
public static SolidColorBrush GetButtonBackgroundBrush() => new SolidColorBrush(ButtonBackground);
|
||||
public static SolidColorBrush GetButtonHoverBackgroundBrush() => new SolidColorBrush(ButtonHoverBackground);
|
||||
public static SolidColorBrush GetTextBoxBackgroundBrush() => new SolidColorBrush(TextBoxBackground);
|
||||
public static SolidColorBrush GetTextBoxBorderBrush() => new SolidColorBrush(TextBoxBorder);
|
||||
public static SolidColorBrush GetScrollBarTrackBrush() => new SolidColorBrush(ScrollBarTrack);
|
||||
public static SolidColorBrush GetScrollBarThumbBrush() => new SolidColorBrush(ScrollBarThumb);
|
||||
public static SolidColorBrush GetScrollBarThumbHoverBrush() => new SolidColorBrush(ScrollBarThumbHover);
|
||||
|
||||
/// <summary>
|
||||
/// 更新控件的文字颜色
|
||||
/// </summary>
|
||||
public static void UpdateTextBlockColors(System.Windows.DependencyObject parent)
|
||||
{
|
||||
for (int i = 0; i < System.Windows.Media.VisualTreeHelper.GetChildrenCount(parent); i++)
|
||||
{
|
||||
var child = System.Windows.Media.VisualTreeHelper.GetChild(parent, i);
|
||||
if (child is System.Windows.Controls.TextBlock textBlock)
|
||||
{
|
||||
var foreground = textBlock.Foreground as SolidColorBrush;
|
||||
if (foreground != null)
|
||||
{
|
||||
var color = foreground.Color;
|
||||
// 检查是否是硬编码的浅色主题颜色
|
||||
if (color.R == 46 && color.G == 52 && color.B == 54) // #2e3436 - 主文字
|
||||
{
|
||||
textBlock.Foreground = GetTextPrimaryBrush();
|
||||
}
|
||||
else if (color.R == 154 && color.G == 153 && color.B == 150) // #9a9996 - 次要文字
|
||||
{
|
||||
textBlock.Foreground = GetTextSecondaryBrush();
|
||||
}
|
||||
else if (color.R == 34 && color.G == 34 && color.B == 34) // #222222 - 深色文字
|
||||
{
|
||||
textBlock.Foreground = GetTextPrimaryBrush();
|
||||
}
|
||||
}
|
||||
}
|
||||
UpdateTextBlockColors(child);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新控件的边框和背景颜色
|
||||
/// </summary>
|
||||
public static void UpdateBorderColors(System.Windows.DependencyObject parent)
|
||||
{
|
||||
for (int i = 0; i < System.Windows.Media.VisualTreeHelper.GetChildrenCount(parent); i++)
|
||||
{
|
||||
var child = System.Windows.Media.VisualTreeHelper.GetChild(parent, i);
|
||||
if (child is System.Windows.Controls.Border border)
|
||||
{
|
||||
var background = border.Background as SolidColorBrush;
|
||||
if (background != null)
|
||||
{
|
||||
var color = background.Color;
|
||||
// 检查是否是硬编码的浅色主题颜色
|
||||
if (color.R == 235 && color.G == 235 && color.B == 235) // #ebebeb - 分隔线
|
||||
{
|
||||
border.Background = GetSeparatorBrush();
|
||||
}
|
||||
else if (color.R == 217 && color.G == 217 && color.B == 217) // #d9d9d9 - 按钮背景
|
||||
{
|
||||
border.Background = GetButtonBackgroundBrush();
|
||||
}
|
||||
else if (color.R == 225 && color.G == 225 && color.B == 225) // #e1e1e1 - 按钮背景/分隔线
|
||||
{
|
||||
// 检查是否是按钮(有内边距或特定尺寸)
|
||||
if (border.Padding.Left > 0 || border.Padding.Top > 0 ||
|
||||
(border.Width > 0 && border.Height > 0 && border.Width < 200 && border.Height < 100))
|
||||
{
|
||||
border.Background = GetButtonBackgroundBrush();
|
||||
}
|
||||
else
|
||||
{
|
||||
// 可能是分隔线
|
||||
border.Background = GetSeparatorBrush();
|
||||
}
|
||||
}
|
||||
else if (color.R == 255 && color.G == 255 && color.B == 255) // White - 白色背景
|
||||
{
|
||||
// 检查是否是搜索结果项(有圆角和内边距)
|
||||
if (border.CornerRadius.TopLeft == 6 && border.CornerRadius.TopRight == 6 &&
|
||||
border.CornerRadius.BottomLeft == 6 && border.CornerRadius.BottomRight == 6 &&
|
||||
border.Padding.Left > 0 && border.Padding.Top > 0)
|
||||
{
|
||||
// 搜索结果项背景
|
||||
border.Background = IsDarkTheme
|
||||
? new SolidColorBrush(Color.FromRgb(43, 43, 43)) // 深色主题搜索结果项背景
|
||||
: new SolidColorBrush(Colors.White);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 其他白色背景(如搜索框)
|
||||
border.Background = GetTextBoxBackgroundBrush();
|
||||
}
|
||||
}
|
||||
else if (color.R == 250 && color.G == 250 && color.B == 250) // #fafafa - 主背景
|
||||
{
|
||||
border.Background = GetBackgroundPrimaryBrush();
|
||||
}
|
||||
}
|
||||
|
||||
var borderBrush = border.BorderBrush as SolidColorBrush;
|
||||
if (borderBrush != null)
|
||||
{
|
||||
var color = borderBrush.Color;
|
||||
if (color.R == 230 && color.G == 230 && color.B == 230) // #e6e6e6 - 边框
|
||||
{
|
||||
border.BorderBrush = GetBorderPrimaryBrush();
|
||||
}
|
||||
else if (color.R == 225 && color.G == 225 && color.B == 225) // #e1e1e1 - 边框
|
||||
{
|
||||
border.BorderBrush = GetBorderPrimaryBrush();
|
||||
}
|
||||
else if (color.R == 211 && color.G == 211 && color.B == 211) // #d3d3d3 - 边框
|
||||
{
|
||||
border.BorderBrush = GetBorderTertiaryBrush();
|
||||
}
|
||||
}
|
||||
}
|
||||
UpdateBorderColors(child);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新控件的线条颜色
|
||||
/// </summary>
|
||||
public static void UpdateLineColors(System.Windows.DependencyObject parent)
|
||||
{
|
||||
for (int i = 0; i < System.Windows.Media.VisualTreeHelper.GetChildrenCount(parent); i++)
|
||||
{
|
||||
var child = System.Windows.Media.VisualTreeHelper.GetChild(parent, i);
|
||||
if (child is System.Windows.Shapes.Line line)
|
||||
{
|
||||
var stroke = line.Stroke as SolidColorBrush;
|
||||
if (stroke != null)
|
||||
{
|
||||
var color = stroke.Color;
|
||||
if (color.R == 211 && color.G == 211 && color.B == 211) // #d3d3d3 - 分隔线
|
||||
{
|
||||
line.Stroke = GetSeparatorBrush();
|
||||
}
|
||||
}
|
||||
}
|
||||
UpdateLineColors(child);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新控件的文本框和组合框颜色
|
||||
/// </summary>
|
||||
public static void UpdateInputControlsColors(System.Windows.DependencyObject parent)
|
||||
{
|
||||
for (int i = 0; i < System.Windows.Media.VisualTreeHelper.GetChildrenCount(parent); i++)
|
||||
{
|
||||
var child = System.Windows.Media.VisualTreeHelper.GetChild(parent, i);
|
||||
if (child is System.Windows.Controls.TextBox textBox)
|
||||
{
|
||||
var foreground = textBox.Foreground as SolidColorBrush;
|
||||
if (foreground != null)
|
||||
{
|
||||
var color = foreground.Color;
|
||||
if (color.R == 46 && color.G == 52 && color.B == 54) // #2e3436
|
||||
{
|
||||
textBox.Foreground = GetTextPrimaryBrush();
|
||||
}
|
||||
}
|
||||
var background = textBox.Background as SolidColorBrush;
|
||||
if (background != null)
|
||||
{
|
||||
var color = background.Color;
|
||||
if (color.R == 255 && color.G == 255 && color.B == 255) // 白色背景
|
||||
{
|
||||
textBox.Background = IsDarkTheme ? GetBackgroundSecondaryBrush() : new SolidColorBrush(System.Windows.Media.Colors.White);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (child is System.Windows.Controls.ComboBox comboBox)
|
||||
{
|
||||
var foreground = comboBox.Foreground as SolidColorBrush;
|
||||
if (foreground != null)
|
||||
{
|
||||
var color = foreground.Color;
|
||||
if (color.R == 46 && color.G == 52 && color.B == 54) // #2e3436
|
||||
{
|
||||
comboBox.Foreground = GetTextPrimaryBrush();
|
||||
}
|
||||
}
|
||||
}
|
||||
UpdateInputControlsColors(child);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新控件的按钮颜色
|
||||
/// </summary>
|
||||
public static void UpdateButtonColors(System.Windows.DependencyObject parent)
|
||||
{
|
||||
for (int i = 0; i < System.Windows.Media.VisualTreeHelper.GetChildrenCount(parent); i++)
|
||||
{
|
||||
var child = System.Windows.Media.VisualTreeHelper.GetChild(parent, i);
|
||||
if (child is System.Windows.Controls.Button button)
|
||||
{
|
||||
var background = button.Background as SolidColorBrush;
|
||||
if (background != null)
|
||||
{
|
||||
var color = background.Color;
|
||||
// 检查是否是默认按钮(没有特定背景色)或特定颜色的按钮
|
||||
if (color.R == 37 && color.G == 99 && color.B == 235) // #2563eb - 蓝色按钮(保持原色)
|
||||
{
|
||||
// 蓝色按钮保持原色,但更新文字颜色
|
||||
if (button.Foreground is SolidColorBrush fgBrush &&
|
||||
fgBrush.Color.R == 255 && fgBrush.Color.G == 255 && fgBrush.Color.B == 255)
|
||||
{
|
||||
button.Foreground = new SolidColorBrush(Colors.White); // 保持白色文字
|
||||
}
|
||||
}
|
||||
else if (color.R == 255 && color.G == 255 && color.B == 255) // 白色背景按钮
|
||||
{
|
||||
button.Background = GetButtonBackgroundBrush();
|
||||
button.Foreground = GetTextPrimaryBrush();
|
||||
}
|
||||
else if (color.A == 0 || color == System.Windows.Media.Colors.Transparent) // 透明背景
|
||||
{
|
||||
// 透明背景按钮,只更新文字颜色
|
||||
button.Foreground = GetTextPrimaryBrush();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 没有背景色的按钮,更新文字颜色
|
||||
button.Foreground = GetTextPrimaryBrush();
|
||||
}
|
||||
}
|
||||
UpdateButtonColors(child);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新控件中的图标颜色
|
||||
/// </summary>
|
||||
public static void UpdateImageIconColors(System.Windows.DependencyObject parent)
|
||||
{
|
||||
for (int i = 0; i < System.Windows.Media.VisualTreeHelper.GetChildrenCount(parent); i++)
|
||||
{
|
||||
var child = System.Windows.Media.VisualTreeHelper.GetChild(parent, i);
|
||||
if (child is System.Windows.Controls.Image image && image.Source is DrawingImage drawingImage)
|
||||
{
|
||||
if (drawingImage.Drawing is DrawingGroup drawingGroup)
|
||||
{
|
||||
Color iconColor = IsDarkTheme
|
||||
? Color.FromRgb(243, 243, 243) // 深色主题使用浅色图标 #F3F3F3
|
||||
: Color.FromRgb(34, 34, 34); // 浅色主题使用深色图标 #222222
|
||||
|
||||
// 检查图标是否使用了深色(需要更新的颜色)
|
||||
bool needsUpdate = false;
|
||||
foreach (var drawing in drawingGroup.Children)
|
||||
{
|
||||
if (drawing is GeometryDrawing geometryDrawing)
|
||||
{
|
||||
if (geometryDrawing.Brush is SolidColorBrush brush)
|
||||
{
|
||||
var color = brush.Color;
|
||||
if (color.R == 34 && color.G == 34 && color.B == 34) // #222222
|
||||
{
|
||||
needsUpdate = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (geometryDrawing.Pen?.Brush is SolidColorBrush penBrush)
|
||||
{
|
||||
var color = penBrush.Color;
|
||||
if (color.R == 34 && color.G == 34 && color.B == 34) // #222222
|
||||
{
|
||||
needsUpdate = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (needsUpdate)
|
||||
{
|
||||
// 克隆并更新图标颜色
|
||||
var clonedDrawing = CloneDrawingGroupForTheme(drawingGroup, iconColor);
|
||||
image.Source = new DrawingImage { Drawing = clonedDrawing };
|
||||
}
|
||||
}
|
||||
}
|
||||
UpdateImageIconColors(child);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 克隆 DrawingGroup 并更新颜色(用于主题适配)
|
||||
/// </summary>
|
||||
private static DrawingGroup CloneDrawingGroupForTheme(DrawingGroup source, Color newColor)
|
||||
{
|
||||
var cloned = new DrawingGroup();
|
||||
cloned.ClipGeometry = source.ClipGeometry?.Clone();
|
||||
cloned.Opacity = source.Opacity;
|
||||
cloned.Transform = source.Transform?.Clone();
|
||||
|
||||
foreach (var drawing in source.Children)
|
||||
{
|
||||
if (drawing is GeometryDrawing geometryDrawing)
|
||||
{
|
||||
var clonedGeometry = geometryDrawing.Geometry?.Clone();
|
||||
var clonedBrush = CloneBrushForTheme(geometryDrawing.Brush, newColor);
|
||||
var clonedPen = geometryDrawing.Pen != null
|
||||
? ClonePenForTheme(geometryDrawing.Pen, newColor)
|
||||
: null;
|
||||
|
||||
cloned.Children.Add(new GeometryDrawing(clonedBrush, clonedPen, clonedGeometry));
|
||||
}
|
||||
else if (drawing is DrawingGroup subGroup)
|
||||
{
|
||||
cloned.Children.Add(CloneDrawingGroupForTheme(subGroup, newColor));
|
||||
}
|
||||
else
|
||||
{
|
||||
cloned.Children.Add(drawing);
|
||||
}
|
||||
}
|
||||
|
||||
return cloned;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 克隆 Brush 并更新颜色(用于主题适配)
|
||||
/// </summary>
|
||||
private static Brush CloneBrushForTheme(Brush source, Color newColor)
|
||||
{
|
||||
if (source is SolidColorBrush solidBrush)
|
||||
{
|
||||
var originalColor = solidBrush.Color;
|
||||
if (originalColor.R == 34 && originalColor.G == 34 && originalColor.B == 34) // #222222
|
||||
{
|
||||
return new SolidColorBrush(newColor) { Opacity = solidBrush.Opacity };
|
||||
}
|
||||
else if (originalColor.A > 0 && originalColor != Colors.Transparent &&
|
||||
originalColor.R < 50 && originalColor.G < 50 && originalColor.B < 50) // 深色
|
||||
{
|
||||
return new SolidColorBrush(newColor) { Opacity = solidBrush.Opacity };
|
||||
}
|
||||
return new SolidColorBrush(originalColor) { Opacity = solidBrush.Opacity };
|
||||
}
|
||||
return source?.Clone();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 克隆 Pen 并更新颜色(用于主题适配)
|
||||
/// </summary>
|
||||
private static Pen ClonePenForTheme(Pen source, Color newColor)
|
||||
{
|
||||
var clonedBrush = CloneBrushForTheme(source.Brush, newColor);
|
||||
return new Pen(clonedBrush, source.Thickness)
|
||||
{
|
||||
StartLineCap = source.StartLineCap,
|
||||
EndLineCap = source.EndLineCap,
|
||||
LineJoin = source.LineJoin,
|
||||
MiterLimit = source.MiterLimit
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题到整个控件树
|
||||
/// </summary>
|
||||
public static void ApplyThemeToControl(System.Windows.DependencyObject control)
|
||||
{
|
||||
UpdateTextBlockColors(control);
|
||||
UpdateBorderColors(control);
|
||||
UpdateLineColors(control);
|
||||
UpdateInputControlsColors(control);
|
||||
UpdateButtonColors(control);
|
||||
UpdateImageIconColors(control);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,13 +36,13 @@
|
||||
<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="ThemeLightBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="Theme_Light" Margin="0,0,8,8">
|
||||
<Border x:Name="ThemeLightBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="Theme_Light" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="浅色主题"/>
|
||||
</Border>
|
||||
<Border x:Name="ThemeDarkBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="Theme_Dark" Margin="0,0,8,8">
|
||||
<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">
|
||||
<Border x:Name="ThemeSystemBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="Theme_System" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="跟随系统"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
@@ -58,7 +58,7 @@
|
||||
<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 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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -76,7 +76,8 @@
|
||||
Style="{StaticResource ComboBoxStyle}"
|
||||
ItemContainerStyle="{StaticResource ComboBoxItemStyle}"
|
||||
HorizontalAlignment="Left"
|
||||
Width="200">
|
||||
Width="200"
|
||||
SelectionChanged="ComboBoxSplashScreenStyle_SelectionChanged">
|
||||
<ComboBoxItem Content="随机" Tag="SplashScreenStyle_Random"/>
|
||||
<ComboBoxItem Content="跟随四季" Tag="SplashScreenStyle_Season"/>
|
||||
<ComboBoxItem Content="春季" Tag="SplashScreenStyle_Spring"/>
|
||||
@@ -102,7 +103,8 @@
|
||||
ItemContainerStyle="{StaticResource ComboBoxItemStyle}"
|
||||
HorizontalAlignment="Left"
|
||||
Width="250"
|
||||
SelectedIndex="0">
|
||||
SelectedIndex="0"
|
||||
SelectionChanged="ComboBoxFloatingBarImg_SelectionChanged">
|
||||
<ComboBoxItem Content=""ICC-CE"默认" Tag="FloatingBarImg_Default" IsSelected="True"/>
|
||||
<ComboBoxItem Content=""ICC-CE"无阴影" Tag="FloatingBarImg_NoShadow"/>
|
||||
<ComboBoxItem Content=""ICC-CE"深色" Tag="FloatingBarImg_Dark"/>
|
||||
@@ -132,7 +134,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="调整浮动工具栏的大小" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="ViewboxFloatingBarScaleTransformValueSlider" Width="150" Minimum="0.5" Maximum="1.25" Value="1" TickFrequency="0.05" IsSnapToTickEnabled="True"/>
|
||||
<Slider x:Name="ViewboxFloatingBarScaleTransformValueSlider" Width="150" Minimum="0.5" Maximum="1.25" Value="1" TickFrequency="0.05" IsSnapToTickEnabled="True" ValueChanged="ViewboxFloatingBarScaleTransformValueSlider_ValueChanged"/>
|
||||
<TextBlock x:Name="ViewboxFloatingBarScaleTransformValueText" Text="1.00" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
@@ -143,7 +145,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="调整浮动工具栏的透明度" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="ViewboxFloatingBarOpacityValueSlider" Width="150" Minimum="0.3" Maximum="1" Value="1" TickFrequency="0.05" IsSnapToTickEnabled="True"/>
|
||||
<Slider x:Name="ViewboxFloatingBarOpacityValueSlider" Width="150" Minimum="0.3" Maximum="1" Value="1" TickFrequency="0.05" IsSnapToTickEnabled="True" ValueChanged="ViewboxFloatingBarOpacityValueSlider_ValueChanged"/>
|
||||
<TextBlock x:Name="ViewboxFloatingBarOpacityValueText" Text="1.00" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
@@ -154,7 +156,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在PPT模式下浮动工具栏的透明度(重新进入PPT放映后生效)" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="ViewboxFloatingBarOpacityInPPTValueSlider" Width="150" Minimum="0.3" Maximum="1" Value="1" TickFrequency="0.05" IsSnapToTickEnabled="True"/>
|
||||
<Slider x:Name="ViewboxFloatingBarOpacityInPPTValueSlider" Width="150" Minimum="0.3" Maximum="1" Value="1" TickFrequency="0.05" IsSnapToTickEnabled="True" ValueChanged="ViewboxFloatingBarOpacityInPPTValueSlider_ValueChanged"/>
|
||||
<TextBlock x:Name="ViewboxFloatingBarOpacityInPPTValueText" Text="1.00" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
@@ -164,7 +166,7 @@
|
||||
<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 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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -178,7 +180,7 @@
|
||||
<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>
|
||||
<CheckBox x:Name="CheckBoxUseLegacyFloatingBarUI" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0"/>
|
||||
<CheckBox x:Name="CheckBoxUseLegacyFloatingBarUI" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
@@ -192,7 +194,7 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="显示形状按钮" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在浮动栏中显示形状按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<CheckBox x:Name="CheckBoxShowShapeButton" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" IsChecked="True"/>
|
||||
<CheckBox x:Name="CheckBoxShowShapeButton" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" IsChecked="True" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
@@ -200,7 +202,7 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="显示撤销按钮" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在浮动栏中显示撤销按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<CheckBox x:Name="CheckBoxShowUndoButton" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" IsChecked="True"/>
|
||||
<CheckBox x:Name="CheckBoxShowUndoButton" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" IsChecked="True" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
@@ -208,7 +210,7 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="显示重做按钮" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在浮动栏中显示重做按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<CheckBox x:Name="CheckBoxShowRedoButton" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" IsChecked="True"/>
|
||||
<CheckBox x:Name="CheckBoxShowRedoButton" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" IsChecked="True" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
@@ -216,7 +218,7 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="显示清空按钮" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在浮动栏中显示清空按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<CheckBox x:Name="CheckBoxShowClearButton" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" IsChecked="True"/>
|
||||
<CheckBox x:Name="CheckBoxShowClearButton" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" IsChecked="True" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
@@ -224,7 +226,7 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="显示白板按钮" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在浮动栏中显示白板按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<CheckBox x:Name="CheckBoxShowWhiteboardButton" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" IsChecked="True"/>
|
||||
<CheckBox x:Name="CheckBoxShowWhiteboardButton" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" IsChecked="True" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
@@ -232,7 +234,7 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="显示隐藏按钮" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在浮动栏中显示隐藏按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<CheckBox x:Name="CheckBoxShowHideButton" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" IsChecked="True"/>
|
||||
<CheckBox x:Name="CheckBoxShowHideButton" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" IsChecked="True" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
@@ -240,7 +242,7 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="显示套索选择按钮" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在浮动栏中显示套索选择按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<CheckBox x:Name="CheckBoxShowLassoSelectButton" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" IsChecked="True"/>
|
||||
<CheckBox x:Name="CheckBoxShowLassoSelectButton" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" IsChecked="True" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
@@ -248,7 +250,7 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="显示清并鼠按钮" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在浮动栏中显示清并鼠按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<CheckBox x:Name="CheckBoxShowClearAndMouseButton" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" IsChecked="True"/>
|
||||
<CheckBox x:Name="CheckBoxShowClearAndMouseButton" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" IsChecked="True" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
@@ -256,7 +258,7 @@
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="显示快捷调色盘" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在浮动栏中显示快捷调色盘" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<CheckBox x:Name="CheckBoxShowQuickColorPalette" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0"/>
|
||||
<CheckBox x:Name="CheckBoxShowQuickColorPalette" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
@@ -265,10 +267,10 @@
|
||||
<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="QuickColorPaletteDisplayModeSingleBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="QuickColorPaletteDisplayMode_Single" Margin="0,0,8,8">
|
||||
<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">
|
||||
<Border x:Name="QuickColorPaletteDisplayModeDoubleBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="QuickColorPaletteDisplayMode_Double" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="双行显示(8色)"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
@@ -280,16 +282,16 @@
|
||||
<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">
|
||||
<Border x:Name="EraserDisplayOptionBothBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" 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">
|
||||
<Border x:Name="EraserDisplayOptionAreaBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="EraserDisplayOption_Area" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="仅显示面积擦"/>
|
||||
</Border>
|
||||
<Border x:Name="EraserDisplayOptionLineBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="EraserDisplayOption_Line" Margin="0,0,8,8">
|
||||
<Border x:Name="EraserDisplayOptionLineBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="EraserDisplayOption_Line" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="仅显示线擦"/>
|
||||
</Border>
|
||||
<Border x:Name="EraserDisplayOptionNoneBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="EraserDisplayOption_None" Margin="0,0,8,8">
|
||||
<Border x:Name="EraserDisplayOptionNoneBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="EraserDisplayOption_None" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="都不显示"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
@@ -306,7 +308,7 @@
|
||||
<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 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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -326,7 +328,7 @@
|
||||
<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 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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -340,7 +342,7 @@
|
||||
<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 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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -354,7 +356,7 @@
|
||||
<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 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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -369,16 +371,16 @@
|
||||
<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="ChickenSoupSourceOsuBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="ChickenSoupSource_Osu" Margin="0,0,8,8">
|
||||
<Border x:Name="ChickenSoupSourceOsuBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="ChickenSoupSource_Osu" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="osu!玩家语录"/>
|
||||
</Border>
|
||||
<Border x:Name="ChickenSoupSourceMotivationalBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="ChickenSoupSource_Motivational" Margin="0,0,8,8">
|
||||
<Border x:Name="ChickenSoupSourceMotivationalBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="ChickenSoupSource_Motivational" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="励志立志的名言警句"/>
|
||||
</Border>
|
||||
<Border x:Name="ChickenSoupSourceGaokaoBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="ChickenSoupSource_Gaokao" Margin="0,0,8,8">
|
||||
<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">
|
||||
<Border x:Name="ChickenSoupSourceHitokotoBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" 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>
|
||||
@@ -395,7 +397,7 @@
|
||||
<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 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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -410,10 +412,10 @@
|
||||
<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">
|
||||
<Border x:Name="UnFoldBtnImgArrowBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" 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">
|
||||
<Border x:Name="UnFoldBtnImgPenBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="UnFoldBtnImg_Pen" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="笔"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
@@ -424,7 +426,7 @@
|
||||
<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 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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -438,7 +440,7 @@
|
||||
<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 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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
@@ -452,7 +454,7 @@
|
||||
<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 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.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
using Ink_Canvas;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using Hardcodet.Wpf.TaskbarNotification;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
@@ -9,13 +16,46 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
/// </summary>
|
||||
public partial class ThemePanel : UserControl
|
||||
{
|
||||
private bool _isLoaded = false;
|
||||
|
||||
public ThemePanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += ThemePanel_Loaded;
|
||||
}
|
||||
|
||||
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);
|
||||
}), System.Windows.Threading.DispatcherPriority.Loaded);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"ThemePanel 启用触摸支持时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<RoutedEventArgs> IsTopBarNeedShadowEffect;
|
||||
public event EventHandler<RoutedEventArgs> IsTopBarNeedNoShadowEffect;
|
||||
public event EventHandler<RoutedEventArgs> ThemeChanged;
|
||||
|
||||
private void ScrollViewerEx_ScrollChanged(object sender, ScrollChangedEventArgs e)
|
||||
{
|
||||
@@ -29,6 +69,740 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载设置到UI
|
||||
/// </summary>
|
||||
public void LoadSettings()
|
||||
{
|
||||
if (MainWindow.Settings == null || MainWindow.Settings.Appearance == null) return;
|
||||
|
||||
_isLoaded = false;
|
||||
|
||||
try
|
||||
{
|
||||
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;
|
||||
if (val == 0) val = 1.0;
|
||||
ViewboxFloatingBarScaleTransformValueSlider.Value = val;
|
||||
if (ViewboxFloatingBarScaleTransformValueText != null)
|
||||
{
|
||||
ViewboxFloatingBarScaleTransformValueText.Text = val.ToString("F2");
|
||||
}
|
||||
}
|
||||
|
||||
// 浮动工具栏透明度
|
||||
if (ViewboxFloatingBarOpacityValueSlider != null)
|
||||
{
|
||||
ViewboxFloatingBarOpacityValueSlider.Value = appearance.ViewboxFloatingBarOpacityValue;
|
||||
if (ViewboxFloatingBarOpacityValueText != null)
|
||||
{
|
||||
ViewboxFloatingBarOpacityValueText.Text = appearance.ViewboxFloatingBarOpacityValue.ToString("F2");
|
||||
}
|
||||
}
|
||||
|
||||
// 浮栏在PPT下透明度
|
||||
if (ViewboxFloatingBarOpacityInPPTValueSlider != null)
|
||||
{
|
||||
ViewboxFloatingBarOpacityInPPTValueSlider.Value = appearance.ViewboxFloatingBarOpacityInPPTValue;
|
||||
if (ViewboxFloatingBarOpacityInPPTValueText != null)
|
||||
{
|
||||
ViewboxFloatingBarOpacityInPPTValueText.Text = appearance.ViewboxFloatingBarOpacityInPPTValue.ToString("F2");
|
||||
}
|
||||
}
|
||||
|
||||
// 在调色盘窗口中显示笔尖模式按钮
|
||||
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;
|
||||
if (CheckBoxShowClearButton != null) CheckBoxShowClearButton.IsChecked = appearance.IsShowClearButton;
|
||||
if (CheckBoxShowWhiteboardButton != null) CheckBoxShowWhiteboardButton.IsChecked = appearance.IsShowWhiteboardButton;
|
||||
if (CheckBoxShowHideButton != null) CheckBoxShowHideButton.IsChecked = appearance.IsShowHideButton;
|
||||
if (CheckBoxShowQuickColorPalette != null) CheckBoxShowQuickColorPalette.IsChecked = appearance.IsShowQuickColorPalette;
|
||||
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}");
|
||||
}
|
||||
|
||||
_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))
|
||||
: new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
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;
|
||||
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
bool isOn = border.Background.ToString() == "#FF3584E4";
|
||||
bool newState = !isOn;
|
||||
SetToggleSwitchState(border, newState);
|
||||
|
||||
string tag = border.Tag?.ToString();
|
||||
if (string.IsNullOrEmpty(tag)) return;
|
||||
|
||||
var appearance = MainWindow.Settings.Appearance;
|
||||
if (appearance == null) return;
|
||||
|
||||
switch (tag)
|
||||
{
|
||||
case "EnableSplashScreen":
|
||||
// 调用 MainWindow 中的方法(带主题检查)
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggledWithThemeCheck("ToggleSwitchEnableSplashScreen", newState);
|
||||
// 更新UI状态
|
||||
if (SplashScreenStylePanel != null)
|
||||
{
|
||||
SplashScreenStylePanel.Visibility = newState ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
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)
|
||||
{
|
||||
taskbar.Visibility = newState ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
private void ComboBoxFloatingBarImg_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
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;
|
||||
if (ViewboxFloatingBarScaleTransformValueSlider != null && ViewboxFloatingBarScaleTransformValueText != null)
|
||||
{
|
||||
double val = ViewboxFloatingBarScaleTransformValueSlider.Value;
|
||||
ViewboxFloatingBarScaleTransformValueText.Text = val.ToString("F2");
|
||||
// 调用 MainWindow 中的方法(会自动检查主题更新)
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("ViewboxFloatingBarScaleTransformValueSlider", val);
|
||||
}
|
||||
}
|
||||
|
||||
private void ViewboxFloatingBarOpacityValueSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
if (ViewboxFloatingBarOpacityValueSlider != null && ViewboxFloatingBarOpacityValueText != null)
|
||||
{
|
||||
double val = ViewboxFloatingBarOpacityValueSlider.Value;
|
||||
ViewboxFloatingBarOpacityValueText.Text = val.ToString("F2");
|
||||
// 调用 MainWindow 中的方法(会自动检查主题更新)
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("ViewboxFloatingBarOpacityValueSlider", val);
|
||||
}
|
||||
}
|
||||
|
||||
private void ViewboxFloatingBarOpacityInPPTValueSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
if (ViewboxFloatingBarOpacityInPPTValueSlider != null && ViewboxFloatingBarOpacityInPPTValueText != null)
|
||||
{
|
||||
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;
|
||||
|
||||
var checkBox = sender as CheckBox;
|
||||
if (checkBox == null) return;
|
||||
|
||||
string name = checkBox.Name;
|
||||
var appearance = MainWindow.Settings.Appearance;
|
||||
if (appearance == null) return;
|
||||
|
||||
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[]>
|
||||
{
|
||||
{ "Theme", new[] { "Light", "Dark", "System" } },
|
||||
{ "ChickenSoupSource", new[] { "Osu", "Motivational", "Gaokao", "Hitokoto" } },
|
||||
{ "UnFoldBtnImg", new[] { "Arrow", "Pen" } },
|
||||
{ "QuickColorPaletteDisplayMode", new[] { "Single", "Double" } },
|
||||
{ "EraserDisplayOption", new[] { "Both", "Area", "Line", "None" } }
|
||||
};
|
||||
|
||||
if (!buttons.ContainsKey(group)) return;
|
||||
|
||||
string[] buttonNames = buttons[group];
|
||||
|
||||
for (int i = 0; i < buttonNames.Length; i++)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选项按钮点击事件处理
|
||||
/// </summary>
|
||||
private void OptionButton_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 + "_"))
|
||||
{
|
||||
childBorder.Background = new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = childBorder.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 设置当前按钮为选中状态
|
||||
border.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var currentTextBlock = border.Child as TextBlock;
|
||||
if (currentTextBlock != null)
|
||||
{
|
||||
currentTextBlock.FontWeight = FontWeights.Bold;
|
||||
}
|
||||
|
||||
var appearance = MainWindow.Settings.Appearance;
|
||||
if (appearance == null) return;
|
||||
|
||||
switch (group)
|
||||
{
|
||||
case "Theme":
|
||||
// 通过 MainWindowSettingsHelper 调用 ComboBoxTheme 的 SelectionChanged 事件处理器
|
||||
try
|
||||
{
|
||||
var mainWindow = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow != null)
|
||||
{
|
||||
var comboBox = mainWindow.FindName("ComboBoxTheme") as System.Windows.Controls.ComboBox;
|
||||
if (comboBox != null)
|
||||
{
|
||||
// 根据 value 找到对应的 ComboBoxItem
|
||||
int themeIndex;
|
||||
switch (value)
|
||||
{
|
||||
case "Light":
|
||||
themeIndex = 0;
|
||||
break;
|
||||
case "Dark":
|
||||
themeIndex = 1;
|
||||
break;
|
||||
case "System":
|
||||
themeIndex = 2;
|
||||
break;
|
||||
default:
|
||||
themeIndex = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
if (comboBox.Items.Count > themeIndex)
|
||||
{
|
||||
var selectedItem = comboBox.Items[themeIndex];
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChangedWithThemeCheck("ComboBoxTheme", selectedItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置并通知主题更新
|
||||
MainWindowSettingsHelper.UpdateSettingSafely(() =>
|
||||
{
|
||||
appearance.Theme = themeIndex;
|
||||
}, "ComboBoxTheme_SelectionChanged", "ComboBoxTheme");
|
||||
MainWindowSettingsHelper.NotifyThemeUpdateIfNeeded("ComboBoxTheme");
|
||||
|
||||
// 触发主题变化事件,通知设置窗口更新主题
|
||||
ThemeChanged?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置并通知主题更新
|
||||
int themeIndex;
|
||||
switch (value)
|
||||
{
|
||||
case "Light":
|
||||
themeIndex = 0;
|
||||
break;
|
||||
case "Dark":
|
||||
themeIndex = 1;
|
||||
break;
|
||||
case "System":
|
||||
themeIndex = 2;
|
||||
break;
|
||||
default:
|
||||
themeIndex = 2;
|
||||
break;
|
||||
}
|
||||
MainWindowSettingsHelper.UpdateSettingSafely(() =>
|
||||
{
|
||||
appearance.Theme = themeIndex;
|
||||
}, "ComboBoxTheme_SelectionChanged", "ComboBoxTheme");
|
||||
MainWindowSettingsHelper.NotifyThemeUpdateIfNeeded("ComboBoxTheme");
|
||||
|
||||
// 触发主题变化事件,通知设置窗口更新主题
|
||||
ThemeChanged?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"切换主题时出错: {ex.Message}");
|
||||
}
|
||||
break;
|
||||
|
||||
case "ChickenSoupSource":
|
||||
int sourceIndex;
|
||||
switch (value)
|
||||
{
|
||||
case "Osu":
|
||||
sourceIndex = 0;
|
||||
break;
|
||||
case "Motivational":
|
||||
sourceIndex = 1;
|
||||
break;
|
||||
case "Gaokao":
|
||||
sourceIndex = 2;
|
||||
break;
|
||||
case "Hitokoto":
|
||||
sourceIndex = 3;
|
||||
break;
|
||||
default:
|
||||
sourceIndex = 3;
|
||||
break;
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
var mainWindow6 = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow6 != null)
|
||||
{
|
||||
var comboBox = mainWindow6.FindName("ComboBoxChickenSoupSource") as System.Windows.Controls.ComboBox;
|
||||
if (comboBox != null && comboBox.Items.Count > sourceIndex)
|
||||
{
|
||||
comboBox.SelectedIndex = sourceIndex;
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChanged("ComboBoxChickenSoupSource", comboBox.Items[sourceIndex]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
appearance.ChickenSoupSource = sourceIndex;
|
||||
}, "ComboBoxChickenSoupSource");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "UnFoldBtnImg":
|
||||
int imgType;
|
||||
switch (value)
|
||||
{
|
||||
case "Arrow":
|
||||
imgType = 0;
|
||||
break;
|
||||
case "Pen":
|
||||
imgType = 1;
|
||||
break;
|
||||
default:
|
||||
imgType = 0;
|
||||
break;
|
||||
}
|
||||
// 调用 MainWindow 中的方法(带主题检查)
|
||||
var mainWindow3 = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow3 != null)
|
||||
{
|
||||
var comboBox = mainWindow3.FindName("ComboBoxUnFoldBtnImg") as System.Windows.Controls.ComboBox;
|
||||
if (comboBox != null && comboBox.Items.Count > imgType)
|
||||
{
|
||||
comboBox.SelectedIndex = imgType;
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChangedWithThemeCheck("ComboBoxUnFoldBtnImg", comboBox.Items[imgType]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置并通知主题更新
|
||||
MainWindowSettingsHelper.UpdateSettingSafely(() =>
|
||||
{
|
||||
appearance.UnFoldButtonImageType = imgType;
|
||||
}, "ComboBoxUnFoldBtnImg_SelectionChanged", "ComboBoxUnFoldBtnImg");
|
||||
MainWindowSettingsHelper.NotifyThemeUpdateIfNeeded("ComboBoxUnFoldBtnImg");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "QuickColorPaletteDisplayMode":
|
||||
int displayMode;
|
||||
switch (value)
|
||||
{
|
||||
case "Single":
|
||||
displayMode = 0;
|
||||
break;
|
||||
case "Double":
|
||||
displayMode = 1;
|
||||
break;
|
||||
default:
|
||||
displayMode = 1;
|
||||
break;
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
var mainWindow4 = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow4 != null)
|
||||
{
|
||||
var comboBox = mainWindow4.FindName("ComboBoxQuickColorPaletteDisplayMode") as System.Windows.Controls.ComboBox;
|
||||
if (comboBox != null && comboBox.Items.Count > displayMode)
|
||||
{
|
||||
comboBox.SelectedIndex = displayMode;
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChanged("ComboBoxQuickColorPaletteDisplayMode", comboBox.Items[displayMode]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
appearance.QuickColorPaletteDisplayMode = displayMode;
|
||||
}, "ComboBoxQuickColorPaletteDisplayMode");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "EraserDisplayOption":
|
||||
int eraserOption;
|
||||
switch (value)
|
||||
{
|
||||
case "Both":
|
||||
eraserOption = 0;
|
||||
break;
|
||||
case "Area":
|
||||
eraserOption = 1;
|
||||
break;
|
||||
case "Line":
|
||||
eraserOption = 2;
|
||||
break;
|
||||
case "None":
|
||||
eraserOption = 3;
|
||||
break;
|
||||
default:
|
||||
eraserOption = 0;
|
||||
break;
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
var mainWindow5 = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow5 != null)
|
||||
{
|
||||
var comboBox = mainWindow5.FindName("ComboBoxEraserDisplayOption") as System.Windows.Controls.ComboBox;
|
||||
if (comboBox != null && comboBox.Items.Count > eraserOption)
|
||||
{
|
||||
comboBox.SelectedIndex = eraserOption;
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChanged("ComboBoxEraserDisplayOption", comboBox.Items[eraserOption]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
appearance.EraserDisplayOption = eraserOption;
|
||||
}, "ComboBoxEraserDisplayOption");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"ThemePanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,21 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"TimerPanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
xmlns:settingsViews="clr-namespace:Ink_Canvas.Windows.SettingsViews"
|
||||
WindowStartupLocation="CenterScreen" d:DesignHeight="19198"
|
||||
mc:Ignorable="d" WindowStyle="None" ResizeMode="CanMinimize" Background="Transparent"
|
||||
@@ -91,11 +92,39 @@
|
||||
</DrawingImage>
|
||||
<DrawingImage x:Key="AppearanceIcon">
|
||||
<DrawingImage.Drawing>
|
||||
<DrawingGroup ClipGeometry="M0,0 V16 H17 V0 H0 Z">
|
||||
<DrawingGroup.Transform>
|
||||
<TranslateTransform X="0" Y="0.0078125" />
|
||||
</DrawingGroup.Transform>
|
||||
<GeometryDrawing Brush="#FF222222" Geometry="F1 M17,16z M0,0z M14.3604,-0.0078125L10.8916,3.44922C11.5752,3.80469,12.126,4.35937,12.4814,5.03906L12.6533,4.86719 12.6611,4.87518 16.9619,0.574219 16.9619,-0.0078125 14.3604,-0.0078125z M3.96191,0.992188C2.31738,0.992188,0.961914,2.34766,0.961914,3.99219L0.961914,9.99219C0.961914,11.6367,2.31738,12.9922,3.96191,12.9922L13.9619,12.9922C15.6064,12.9922,16.9619,11.6367,16.9619,9.99219L16.9619,3.99219C16.9619,3.42188,16.7939,2.89062,16.5127,2.43359L14.9619,3.98828 14.9619,9.99219C14.9619,10.5625,14.5322,10.9922,13.9619,10.9922L3.96191,10.9922C3.3916,10.9922,2.96191,10.5625,2.96191,9.99219L2.96191,3.99219C2.96191,3.42188,3.3916,2.99219,3.96191,2.99219L9.93066,2.99219 11.9385,0.992188 3.96191,0.992188z M8.96191,3.99219C7.30566,3.99219,5.96191,5.33203,5.96191,6.99219L5.96191,9.99219 8.96191,9.99219C10.6221,10.0002 11.9619,8.64844 11.9619,6.99219 11.9619,5.33203 10.6221,3.99219 8.96191,3.99219z M5.96191,13.9922C4.85644,13.9922,3.96191,14.8867,3.96191,15.9922L13.9619,15.9922C13.9619,14.8867,13.0674,13.9922,11.9619,13.9922L5.96191,13.9922z" />
|
||||
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
|
||||
<GeometryDrawing Brush="Transparent">
|
||||
<GeometryDrawing.Geometry>
|
||||
<PathGeometry Figures="M12 21C9.61305 21 7.32387 20.0518 5.63604 18.364C3.94821 16.6761 3 14.3869 3 12C3 9.61305 3.94821 7.32387 5.63604 5.63604C7.32387 3.94821 9.61305 3 12 3C16.97 3 21 6.582 21 11C21 12.06 20.526 13.078 19.682 13.828C18.838 14.578 17.693 15 16.5 15H14C13.5539 14.9928 13.1181 15.135 12.7621 15.404C12.4061 15.673 12.1503 16.0533 12.0353 16.4844C11.9203 16.9155 11.9528 17.3727 12.1276 17.7833C12.3025 18.1938 12.6095 18.5341 13 18.75C13.1997 18.9342 13.3366 19.1764 13.3915 19.4425C13.4465 19.7085 13.4167 19.9851 13.3064 20.2334C13.196 20.4816 13.0107 20.6891 12.7764 20.8266C12.5421 20.9641 12.2705 21.0247 12 21Z" />
|
||||
</GeometryDrawing.Geometry>
|
||||
<GeometryDrawing.Pen>
|
||||
<Pen Brush="#FF222222" Thickness="2" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" />
|
||||
</GeometryDrawing.Pen>
|
||||
</GeometryDrawing>
|
||||
<GeometryDrawing Brush="Transparent">
|
||||
<GeometryDrawing.Geometry>
|
||||
<PathGeometry Figures="M7.5 10.5C7.5 10.7652 7.60536 11.0196 7.79289 11.2071C7.98043 11.3946 8.23478 11.5 8.5 11.5C8.76522 11.5 9.01957 11.3946 9.20711 11.2071C9.39464 11.0196 9.5 10.7652 9.5 10.5C9.5 10.2348 9.39464 9.98043 9.20711 9.79289C9.01957 9.60536 8.76522 9.5 8.5 9.5C8.23478 9.5 7.98043 9.60536 7.79289 9.79289C7.60536 9.98043 7.5 10.2348 7.5 10.5Z" />
|
||||
</GeometryDrawing.Geometry>
|
||||
<GeometryDrawing.Pen>
|
||||
<Pen Brush="#FF222222" Thickness="2" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" />
|
||||
</GeometryDrawing.Pen>
|
||||
</GeometryDrawing>
|
||||
<GeometryDrawing Brush="Transparent">
|
||||
<GeometryDrawing.Geometry>
|
||||
<PathGeometry Figures="M11.5 7.5C11.5 7.76522 11.6054 8.01957 11.7929 8.20711C11.9804 8.39464 12.2348 8.5 12.5 8.5C12.7652 8.5 13.0196 8.39464 13.2071 8.20711C13.3946 8.01957 13.5 7.76522 13.5 7.5C13.5 7.23478 13.3946 6.98043 13.2071 6.79289C13.0196 6.60536 12.7652 6.5 12.5 6.5C12.2348 6.5 11.9804 6.60536 11.7929 6.79289C11.6054 6.98043 11.5 7.23478 11.5 7.5Z" />
|
||||
</GeometryDrawing.Geometry>
|
||||
<GeometryDrawing.Pen>
|
||||
<Pen Brush="#FF222222" Thickness="2" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" />
|
||||
</GeometryDrawing.Pen>
|
||||
</GeometryDrawing>
|
||||
<GeometryDrawing Brush="Transparent">
|
||||
<GeometryDrawing.Geometry>
|
||||
<PathGeometry Figures="M15.5 10.5C15.5 10.7652 15.6054 11.0196 15.7929 11.2071C15.9804 11.3946 16.2348 11.5 16.5 11.5C16.7652 11.5 17.0196 11.3946 17.2071 11.2071C17.3946 11.0196 17.5 10.7652 17.5 10.5C17.5 10.2348 17.3946 9.98043 17.2071 9.79289C17.0196 9.60536 16.7652 9.5 16.5 9.5C16.2348 9.5 15.9804 9.60536 15.7929 9.79289C15.6054 9.98043 15.5 10.2348 15.5 10.5Z" />
|
||||
</GeometryDrawing.Geometry>
|
||||
<GeometryDrawing.Pen>
|
||||
<Pen Brush="#FF222222" Thickness="2" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" />
|
||||
</GeometryDrawing.Pen>
|
||||
</GeometryDrawing>
|
||||
</DrawingGroup>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
@@ -174,6 +203,102 @@
|
||||
</DrawingGroup>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
<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" />
|
||||
</GeometryDrawing.Geometry>
|
||||
<GeometryDrawing.Pen>
|
||||
<Pen Brush="#FF222222" Thickness="2" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" />
|
||||
</GeometryDrawing.Pen>
|
||||
</GeometryDrawing>
|
||||
<!-- 第一行按键点 -->
|
||||
<GeometryDrawing>
|
||||
<GeometryDrawing.Geometry>
|
||||
<PathGeometry Figures="M6,10 L6,10.01" />
|
||||
</GeometryDrawing.Geometry>
|
||||
<GeometryDrawing.Pen>
|
||||
<Pen Brush="#FF222222" Thickness="2" StartLineCap="Round" EndLineCap="Round" />
|
||||
</GeometryDrawing.Pen>
|
||||
</GeometryDrawing>
|
||||
<GeometryDrawing>
|
||||
<GeometryDrawing.Geometry>
|
||||
<PathGeometry Figures="M10,10 L10,10.01" />
|
||||
</GeometryDrawing.Geometry>
|
||||
<GeometryDrawing.Pen>
|
||||
<Pen Brush="#FF222222" Thickness="2" StartLineCap="Round" EndLineCap="Round" />
|
||||
</GeometryDrawing.Pen>
|
||||
</GeometryDrawing>
|
||||
<GeometryDrawing>
|
||||
<GeometryDrawing.Geometry>
|
||||
<PathGeometry Figures="M14,10 L14,10.01" />
|
||||
</GeometryDrawing.Geometry>
|
||||
<GeometryDrawing.Pen>
|
||||
<Pen Brush="#FF222222" Thickness="2" StartLineCap="Round" EndLineCap="Round" />
|
||||
</GeometryDrawing.Pen>
|
||||
</GeometryDrawing>
|
||||
<GeometryDrawing>
|
||||
<GeometryDrawing.Geometry>
|
||||
<PathGeometry Figures="M18,10 L18,10.01" />
|
||||
</GeometryDrawing.Geometry>
|
||||
<GeometryDrawing.Pen>
|
||||
<Pen Brush="#FF222222" Thickness="2" StartLineCap="Round" EndLineCap="Round" />
|
||||
</GeometryDrawing.Pen>
|
||||
</GeometryDrawing>
|
||||
<!-- 第二行按键 -->
|
||||
<GeometryDrawing>
|
||||
<GeometryDrawing.Geometry>
|
||||
<PathGeometry Figures="M6,14 L6,14.01" />
|
||||
</GeometryDrawing.Geometry>
|
||||
<GeometryDrawing.Pen>
|
||||
<Pen Brush="#FF222222" Thickness="2" StartLineCap="Round" EndLineCap="Round" />
|
||||
</GeometryDrawing.Pen>
|
||||
</GeometryDrawing>
|
||||
<GeometryDrawing>
|
||||
<GeometryDrawing.Geometry>
|
||||
<PathGeometry Figures="M18,14 L18,14.01" />
|
||||
</GeometryDrawing.Geometry>
|
||||
<GeometryDrawing.Pen>
|
||||
<Pen Brush="#FF222222" Thickness="2" StartLineCap="Round" EndLineCap="Round" />
|
||||
</GeometryDrawing.Pen>
|
||||
</GeometryDrawing>
|
||||
<!-- 中间长按键 -->
|
||||
<GeometryDrawing>
|
||||
<GeometryDrawing.Geometry>
|
||||
<PathGeometry Figures="M10,14 L14,14" />
|
||||
</GeometryDrawing.Geometry>
|
||||
<GeometryDrawing.Pen>
|
||||
<Pen Brush="#FF222222" Thickness="2" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" />
|
||||
</GeometryDrawing.Pen>
|
||||
</GeometryDrawing>
|
||||
</DrawingGroup>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
<DrawingImage x:Key="CrashActionIcon">
|
||||
<DrawingImage.Drawing>
|
||||
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
|
||||
<GeometryDrawing Brush="Transparent">
|
||||
<GeometryDrawing.Geometry>
|
||||
<PathGeometry Figures="M17.6698,17.667 C16.1271,19.2844 14.1634,20.4387 11.9998,21 C10.443,20.5962 8.98331,19.8836 7.70738,18.9045 C6.43144,17.9254 5.36534,16.6998 4.57243,15.3005 C3.77952,13.9013 3.27597,12.3569 3.09171,10.7592 C2.90745,9.16147 3.04624,7.54302 3.49983,6 C4.29383,6.036 5.08283,5.994 5.85683,5.876 M8.98483,4.95 C10.082,4.45493 11.0983,3.79757 11.9998,3 C14.3357,5.06658 17.3843,6.14257 20.4998,6 C20.9575,7.55707 21.0946,9.19081 20.9028,10.8024 C20.7109,12.4139 20.1942,13.9699 19.3838,15.376" />
|
||||
</GeometryDrawing.Geometry>
|
||||
<GeometryDrawing.Pen>
|
||||
<Pen Brush="#FF222222" Thickness="2" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" />
|
||||
</GeometryDrawing.Pen>
|
||||
</GeometryDrawing>
|
||||
<GeometryDrawing>
|
||||
<GeometryDrawing.Geometry>
|
||||
<PathGeometry Figures="M3,3 L21,21" />
|
||||
</GeometryDrawing.Geometry>
|
||||
<GeometryDrawing.Pen>
|
||||
<Pen Brush="#FF222222" Thickness="2" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" />
|
||||
</GeometryDrawing.Pen>
|
||||
</GeometryDrawing>
|
||||
</DrawingGroup>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
<DrawingImage x:Key="TwoFingerMoveImage">
|
||||
<DrawingImage.Drawing>
|
||||
<DrawingGroup ClipGeometry="M0,0 V256 H256 V0 H0 Z">
|
||||
@@ -493,13 +618,13 @@
|
||||
<WindowChrome GlassFrameThickness="-1" ResizeBorderThickness="0" CaptionHeight="0" CornerRadius="0" />
|
||||
</WindowChrome.WindowChrome>
|
||||
<Grid>
|
||||
<Border Background="#fafafa" CornerRadius="7" BorderBrush="#3584e4" BorderThickness="2" Margin="8">
|
||||
<Border x:Name="MainBorder" Background="#fafafa" CornerRadius="7" BorderBrush="#3584e4" BorderThickness="2" Margin="8">
|
||||
<Grid>
|
||||
<!--Sidebar-->
|
||||
<Border Width="250" Background="#ebebeb" BorderBrush="#e1e1e1" CornerRadius="7,0,0,7" BorderThickness="0,0,2,0" HorizontalAlignment="Left">
|
||||
<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">
|
||||
<Border CornerRadius="8" Background="#d9d9d9" Width="34" Height="34" Margin="8,0,0,0" HorizontalAlignment="Left" MouseLeftButtonDown="SearchButton_Click" Cursor="Hand">
|
||||
<Border x:Name="SearchButtonBorder" CornerRadius="8" Background="#d9d9d9" Width="34" Height="34" Margin="8,0,0,0" HorizontalAlignment="Left" MouseLeftButtonDown="SearchButton_Click" Cursor="Hand">
|
||||
<Image Width="16" Height="16">
|
||||
<Image.Source>
|
||||
<DrawingImage>
|
||||
@@ -512,8 +637,8 @@
|
||||
</Image.Source>
|
||||
</Image>
|
||||
</Border>
|
||||
<TextBlock FontSize="15" Text="软件设置" Foreground="#2e3436" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
<Border CornerRadius="8" Background="#d9d9d9" Width="34" Height="34" Margin="0,0,8,0" HorizontalAlignment="Right" MouseLeftButtonDown="MenuButton_Click" Cursor="Hand">
|
||||
<TextBlock x:Name="TitleTextBlock" FontSize="15" Text="软件设置" Foreground="#2e3436" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
<Border CornerRadius="8" Background="#d9d9d9" Width="34" Height="34" Margin="0,0,8,0" HorizontalAlignment="Right" PreviewMouseLeftButtonDown="MenuButton_Click" Cursor="Hand" x:Name="MenuButtonBorder">
|
||||
<Image Width="16" Height="16">
|
||||
<Image.Source>
|
||||
<DrawingImage>
|
||||
@@ -525,6 +650,70 @@
|
||||
</DrawingImage>
|
||||
</Image.Source>
|
||||
</Image>
|
||||
<Border.ContextMenu>
|
||||
<ContextMenu x:Name="MenuButtonContextMenu" ui:ThemeManager.RequestedTheme="Light" Padding="6">
|
||||
<MenuItem Header="退出软件" Click="MenuItemExit_Click">
|
||||
<MenuItem.Icon>
|
||||
<Image Width="16" Height="16">
|
||||
<Image.Source>
|
||||
<DrawingImage>
|
||||
<DrawingImage.Drawing>
|
||||
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
|
||||
<GeometryDrawing Brush="#FF222222"
|
||||
Geometry="F1 M24,24z M0,0z M13,2C13,1.44772 12.5523,1 12,1 11.4477,1 11,1.44772 11,2L11,12C11,12.5523 11.4477,13 12,13 12.5523,13 13,12.5523 13,12L13,2z" />
|
||||
<GeometryDrawing Brush="#FF222222"
|
||||
Geometry="F1 M24,24z M0,0z M19.1073,5.89303C18.7168,5.50243 18.0837,5.50232 17.6931,5.89277 17.3025,6.28322 17.3024,6.91639 17.6928,7.30698 18.8098,8.42441 19.571,9.84758 19.8802,11.397 20.1894,12.9464 20.0329,14.5528 19.4305,16.0134 18.828,17.474 17.8065,18.7235 16.4948,19.6043 15.1831,20.4851 13.64,20.9578 12.06,20.9628 10.48,20.9677 8.93392,20.5047 7.61674,19.6321 6.29956,18.7595 5.27025,17.5164 4.65863,16.0596 4.04701,14.6028 3.88046,12.9975 4.17999,11.4462 4.47952,9.89485 5.23171,8.46694 6.3417,7.34254 6.7297,6.9495 6.72562,6.31635 6.33258,5.92835 5.93955,5.54036 5.3064,5.54444 4.9184,5.93747 3.5309,7.34298 2.59067,9.12786 2.21626,11.067 1.84185,13.0062 2.05003,15.0128 2.81456,16.8338 3.57909,18.6549 4.86572,20.2087 6.5122,21.2994 8.15867,22.3902 10.0913,22.9689 12.0662,22.9627 14.0412,22.9566 15.9701,22.3657 17.6098,21.2647 19.2494,20.1637 20.5262,18.6018 21.2793,16.776 22.0324,14.9502 22.2281,12.9424 21.8415,11.0056 21.455,9.06878 20.5036,7.28981 19.1073,5.89303z" />
|
||||
</DrawingGroup>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
</Image.Source>
|
||||
</Image>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="重启软件" Click="MenuItemRestart_Click">
|
||||
<MenuItem.Icon>
|
||||
<Image Width="16" Height="16">
|
||||
<Image.Source>
|
||||
<DrawingImage>
|
||||
<DrawingImage.Drawing>
|
||||
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
|
||||
<GeometryDrawing Brush="#FF222222"
|
||||
Geometry="F1 M24,24z M0,0z M6.34315,6.34315C7.84299,4.8433 9.87707,4.0005 11.9981,4 14.2527,4.00897 16.4167,4.88785 18.039,6.45324L18.5858,7 16,7C15.4477,7 15,7.44772 15,8 15,8.55228 15.4477,9 16,9L21,9C21.1356,9 21.2649,8.97301 21.3828,8.92412 21.5007,8.87532 21.6112,8.80298 21.7071,8.70711 21.8902,8.52405 21.9874,8.28768 21.9989,8.04797 21.9996,8.03199 22,8.016 22,8L22,3C22,2.44772 21.5523,2 21,2 20.4477,2 20,2.44772 20,3L20,5.58579 19.4471,5.03289 19.435,5.02103C17.4405,3.09289,14.7779,2.01044,12.0038,2L12,2C9.34784,2 6.8043,3.05357 4.92893,4.92893 3.05357,6.8043 2,9.34784 2,12 2,12.5523 2.44772,13 3,13 3.55228,13 4,12.5523 4,12 4,9.87827 4.84285,7.84344 6.34315,6.34315z" />
|
||||
<GeometryDrawing Brush="#FF222222"
|
||||
Geometry="F1 M24,24z M0,0z M22,12C22,14.6522 20.9464,17.1957 19.0711,19.0711 17.1957,20.9464 14.6522,22 12,22L11.9962,22C9.22213,21.9896,6.55946,20.9071,4.56496,18.979L4.55289,18.9671 4,18.4142 4,21C4,21.5523 3.55228,22 3,22 2.44772,22 2,21.5523 2,21L2,16.0002C2,15.8646 2.02699,15.7351 2.07588,15.6172 2.12432,15.5001 2.19595,15.3904 2.29078,15.295 2.29219,15.2936 2.2936,15.2922 2.29502,15.2908 2.48924,15.0977 2.74301,15.0008 2.997,15 2.998,15 2.999,15 3,15L8,15C8.55228,15 9,15.4477 9,16 9,16.5523 8.55228,17 8,17L5.41421,17 5.96095,17.5467C7.5833,19.1122 9.74736,19.9911 12.002,20 14.123,19.9995 16.157,19.1567 17.6569,17.6569 19.1571,16.1566 20,14.1217 20,12 20,11.4477 20.4477,11 21,11 21.5523,11 22,11.4477 22,12z" />
|
||||
</DrawingGroup>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
</Image.Source>
|
||||
</Image>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="重置配置" Click="MenuItemReset_Click">
|
||||
<MenuItem.Icon>
|
||||
<Image Width="16" Height="16">
|
||||
<Image.Source>
|
||||
<DrawingImage>
|
||||
<DrawingImage.Drawing>
|
||||
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
|
||||
<GeometryDrawing Brush="#FF222222"
|
||||
Geometry="F1 M24,24z M0,0z M2,6C2,5.44772,2.44772,5,3,5L21,5C21.5523,5 22,5.44772 22,6 22,6.55228 21.5523,7 21,7L3,7C2.44772,7,2,6.55228,2,6z" />
|
||||
<GeometryDrawing Brush="#FF222222"
|
||||
Geometry="F1 M24,24z M0,0z M2,12C2,11.4477,2.44772,11,3,11L7,11C7.55228,11 8,11.4477 8,12 8,12.5523 7.55228,13 7,13L3,13C2.44772,13,2,12.5523,2,12z" />
|
||||
<GeometryDrawing Brush="#FF222222"
|
||||
Geometry="F1 M24,24z M0,0z M3,17C2.44772,17 2,17.4477 2,18 2,18.5523 2.44772,19 3,19L7,19C7.55228,19 8,18.5523 8,18 8,17.4477 7.55228,17 7,17L3,17z" />
|
||||
<GeometryDrawing Brush="#FF222222"
|
||||
Geometry="F1 M24,24z M0,0z M12.3829,11.2029C13.4335,10.1522 14.8952,9.5 16.5,9.5 17.9587,9.5 19.3576,10.0795 20.3891,11.1109 21.4205,12.1424 22,13.5413 22,15 22,16.2593 21.6038,17.4867 20.8675,18.5083 20.1311,19.5299 19.092,20.2939 17.8974,20.6921 16.7027,21.0903 15.413,21.1026 14.211,20.7271 13.009,20.3516 11.9556,19.6074 11.2,18.6 10.8686,18.1582 10.9582,17.5314 11.4,17.2 11.8418,16.8686 12.4686,16.9582 12.8,17.4 13.3037,18.0716 14.006,18.5677 14.8073,18.8181 15.6087,19.0684 16.4685,19.0602 17.2649,18.7947 18.0614,18.5292 18.7541,18.0199 19.245,17.3388 19.7359,16.6578 20,15.8395 20,15 20,14.0717 19.6313,13.1815 18.9749,12.5251 18.3185,11.8687 17.4283,11.5 16.5,11.5 15.4448,11.5 14.4865,11.9278 13.7971,12.6171L13.4142,13 15,13C15.5523,13 16,13.4477 16,14 16,14.5523 15.5523,15 15,15L11.0007,15C10.9997,15 10.998,15 10.997,15 10.8625,14.9996 10.7343,14.9727 10.6172,14.9241 10.5001,14.8757 10.3904,14.804 10.295,14.7092 10.2936,14.7078 10.2922,14.7064 10.2908,14.705 10.196,14.6096 10.1243,14.4999 10.0759,14.3828 10.027,14.2649 10,14.1356 10,14L10,10C10,9.44772 10.4477,9 11,9 11.5523,9 12,9.44772 12,10L12,11.5858 12.3829,11.2029z" />
|
||||
</DrawingGroup>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
</Image.Source>
|
||||
</Image>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<Separator/>
|
||||
<MenuItem Header="切换到老设置" Click="MenuItemSwitchToOldSettings_Click"/>
|
||||
</ContextMenu>
|
||||
</Border.ContextMenu>
|
||||
</Border>
|
||||
</Grid>
|
||||
<ItemsControl Name="SidebarItemsControl">
|
||||
@@ -536,14 +725,14 @@
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Line Visibility="{Binding _spVisibility}" Margin="0,6" HorizontalAlignment="Center" X1="0" X2="234" Y1="0" Y2="0" Stroke="#d3d3d3" StrokeThickness="1" StrokeStartLineCap="Round" StrokeEndLineCap="Round"/>
|
||||
<Line Visibility="{Binding _spVisibility}" Margin="0,6" HorizontalAlignment="Center" X1="0" X2="234" Y1="0" Y2="0" Stroke="{Binding _spStroke}" StrokeThickness="1" StrokeStartLineCap="Round" StrokeEndLineCap="Round"/>
|
||||
<Border MouseDown="SidebarItem_MouseDown" MouseUp="SidebarItem_MouseUp" MouseLeave="SidebarItem_MouseLeave"
|
||||
Tag="{Binding}" Visibility="{Binding _siVisibility}" Background="{Binding _siBackground}" Height="40" Margin="6,0,6,0" CornerRadius="7">
|
||||
<Grid>
|
||||
<Border Height="40" CornerRadius="7" Background="#09090b" IsHitTestVisible="false" Opacity="0" Name="MouseFeedbackBorder"/>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image Width="18" Height="18" Margin="14,0,9,0" VerticalAlignment="Center" Source="{Binding IconSource}"/>
|
||||
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding Title}" Foreground="#FF222222"/>
|
||||
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding Title}" Foreground="{Binding _siForeground}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
@@ -629,11 +818,11 @@
|
||||
|
||||
<!--Topbar-->
|
||||
<Grid Height="48" VerticalAlignment="Top" Margin="250,0,0,0">
|
||||
<Border Height="48" CornerRadius="0,6,0,0" Background="#fafafa">
|
||||
<Border x:Name="TopBarBorder" Height="48" CornerRadius="0,6,0,0" Background="#fafafa">
|
||||
<Border.Clip>
|
||||
<RectangleGeometry Rect="0,0,640,56"/>
|
||||
</Border.Clip>
|
||||
<Border Height="48" CornerRadius="0,6,0,0" Background="#fafafa" >
|
||||
<Border x:Name="TopBarBackgroundBorder" Height="48" CornerRadius="0,6,0,0" Background="#fafafa" >
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Direction="-90" ShadowDepth="3" BlurRadius="4" Color="#000000" Opacity="0.25" x:Name="DropShadowEffectTopBar"/>
|
||||
</Border.Effect>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using Ink_Canvas.Windows.SettingsViews;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
@@ -14,14 +15,27 @@ namespace Ink_Canvas.Windows
|
||||
{
|
||||
public partial class SettingsWindow : Window
|
||||
{
|
||||
private MainWindow _mainWindow;
|
||||
|
||||
public SettingsWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// 获取 MainWindow 实例
|
||||
_mainWindow = Application.Current.MainWindow as MainWindow;
|
||||
|
||||
// 初始化搜索面板事件
|
||||
SearchPanelControl.NavigateToItem += SearchPanel_NavigateToItem;
|
||||
SearchPanelControl.CloseSearch += SearchPanel_CloseSearch;
|
||||
|
||||
// 订阅菜单关闭事件,确保状态同步
|
||||
if (MenuButtonContextMenu != null)
|
||||
{
|
||||
MenuButtonContextMenu.Closed += (s, e) =>
|
||||
{
|
||||
// 菜单关闭时的处理
|
||||
};
|
||||
}
|
||||
|
||||
// 初始化侧边栏项目
|
||||
SidebarItemsControl.ItemsSource = SidebarItems;
|
||||
@@ -74,7 +88,7 @@ namespace Ink_Canvas.Windows
|
||||
Type = SidebarItemType.Item,
|
||||
Title = "快捷键设置",
|
||||
Name = "ShortcutsItem",
|
||||
IconSource = FindResource("AppearanceIcon") as DrawingImage,
|
||||
IconSource = FindResource("ShortcutsIcon") as DrawingImage,
|
||||
Selected = false,
|
||||
});
|
||||
SidebarItems.Add(new SidebarItem()
|
||||
@@ -82,7 +96,7 @@ namespace Ink_Canvas.Windows
|
||||
Type = SidebarItemType.Item,
|
||||
Title = "崩溃处理",
|
||||
Name = "CrashActionItem",
|
||||
IconSource = FindResource("AppearanceIcon") as DrawingImage,
|
||||
IconSource = FindResource("CrashActionIcon") as DrawingImage,
|
||||
Selected = false,
|
||||
});
|
||||
SidebarItems.Add(new SidebarItem()
|
||||
@@ -240,6 +254,13 @@ namespace Ink_Canvas.Windows
|
||||
PowerPointPanel.IsTopBarNeedNoShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0;
|
||||
ThemePanel.IsTopBarNeedShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0.25;
|
||||
ThemePanel.IsTopBarNeedNoShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0;
|
||||
|
||||
// 监听主题变化
|
||||
ThemePanel.ThemeChanged += (o, s) =>
|
||||
{
|
||||
ApplyTheme();
|
||||
ApplyThemeToAllPanels();
|
||||
};
|
||||
ShortcutsPanel.IsTopBarNeedShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0.25;
|
||||
ShortcutsPanel.IsTopBarNeedNoShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0;
|
||||
CrashActionPanel.IsTopBarNeedShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0.25;
|
||||
@@ -253,11 +274,564 @@ namespace Ink_Canvas.Windows
|
||||
AdvancedPanel.IsTopBarNeedShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0.25;
|
||||
AdvancedPanel.IsTopBarNeedNoShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0;
|
||||
|
||||
_selectedSidebarItemName = "CanvasAndInkItem";
|
||||
_selectedSidebarItemName = "StartupItem";
|
||||
|
||||
// 初始化侧边栏项目的主题状态
|
||||
bool isDarkTheme = MainWindow.Settings?.Appearance != null &&
|
||||
(MainWindow.Settings.Appearance.Theme == 1 ||
|
||||
(MainWindow.Settings.Appearance.Theme == 2 && !IsSystemThemeLight()));
|
||||
foreach (var item in SidebarItems)
|
||||
{
|
||||
item.IsDarkTheme = isDarkTheme;
|
||||
}
|
||||
|
||||
UpdateSidebarItemsSelection();
|
||||
|
||||
// 为自定义滑块控件添加触摸支持
|
||||
AddTouchSupportToCustomSliders();
|
||||
|
||||
// 先应用主题,确保标题栏等元素正确显示
|
||||
ApplyTheme();
|
||||
|
||||
// 加载所有面板的设置
|
||||
LoadAllPanelsSettings();
|
||||
|
||||
// 通知所有面板应用主题
|
||||
ApplyThemeToAllPanels();
|
||||
|
||||
// 延迟再次应用主题,确保所有元素都正确应用主题(特别是标题栏)
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
ApplyTheme();
|
||||
ApplyThemeToAllPanels();
|
||||
}), System.Windows.Threading.DispatcherPriority.Loaded);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通知所有面板应用主题
|
||||
/// </summary>
|
||||
private void ApplyThemeToAllPanels()
|
||||
{
|
||||
try
|
||||
{
|
||||
bool isDarkTheme = MainWindow.Settings?.Appearance != null &&
|
||||
(MainWindow.Settings.Appearance.Theme == 1 ||
|
||||
(MainWindow.Settings.Appearance.Theme == 2 && !IsSystemThemeLight()));
|
||||
|
||||
// 使用反射调用所有面板的 ApplyTheme 方法(如果存在)
|
||||
var panels = new UserControl[]
|
||||
{
|
||||
StartupPanel, CanvasAndInkPanel, GesturesPanel, InkRecognitionPanel,
|
||||
ThemePanel, ShortcutsPanel, CrashActionPanel, PowerPointPanel,
|
||||
AutomationPanel, LuckyRandomPanel, StoragePanel, SnapshotPanel,
|
||||
AdvancedPanel, SettingsAboutPanel, AppearancePanel, SearchPanelControl
|
||||
};
|
||||
|
||||
foreach (var panel in panels)
|
||||
{
|
||||
if (panel != null)
|
||||
{
|
||||
var method = panel.GetType().GetMethod("ApplyTheme",
|
||||
System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
|
||||
if (method != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
method.Invoke(panel, null);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"应用主题到 {panel.GetType().Name} 时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"通知面板应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (MainWindow.Settings?.Appearance == null) return;
|
||||
|
||||
bool isDarkTheme = MainWindow.Settings.Appearance.Theme == 1 ||
|
||||
(MainWindow.Settings.Appearance.Theme == 2 && !IsSystemThemeLight());
|
||||
|
||||
if (isDarkTheme)
|
||||
{
|
||||
// 深色主题 - 参考 Windows 系统设置
|
||||
if (MainBorder != null)
|
||||
{
|
||||
MainBorder.Background = ThemeHelper.GetBackgroundPrimaryBrush(); // Windows 系统主背景 #202020
|
||||
MainBorder.BorderBrush = new SolidColorBrush(Color.FromRgb(0, 120, 215)); // Windows 系统强调色(蓝色)
|
||||
}
|
||||
if (SidebarBorder != null)
|
||||
{
|
||||
SidebarBorder.Background = ThemeHelper.GetBackgroundSecondaryBrush(); // Windows 系统次要背景 #191919
|
||||
SidebarBorder.BorderBrush = ThemeHelper.GetBorderPrimaryBrush(); // Windows 系统边框
|
||||
}
|
||||
if (SearchButtonBorder != null)
|
||||
{
|
||||
SearchButtonBorder.Background = ThemeHelper.GetButtonBackgroundBrush(); // Windows 系统按钮背景
|
||||
// 更新搜索按钮图标颜色
|
||||
UpdateButtonIconColor(SearchButtonBorder, true);
|
||||
}
|
||||
if (MenuButtonBorder != null)
|
||||
{
|
||||
MenuButtonBorder.Background = ThemeHelper.GetButtonBackgroundBrush(); // Windows 系统按钮背景
|
||||
// 更新菜单按钮图标颜色
|
||||
UpdateButtonIconColor(MenuButtonBorder, true);
|
||||
}
|
||||
if (TitleTextBlock != null)
|
||||
{
|
||||
TitleTextBlock.Foreground = ThemeHelper.GetTextPrimaryBrush(); // Windows 系统主文字颜色
|
||||
}
|
||||
if (MenuButtonContextMenu != null)
|
||||
{
|
||||
MenuButtonContextMenu.Background = ThemeHelper.GetBackgroundSecondaryBrush(); // Windows 系统菜单背景
|
||||
MenuButtonContextMenu.BorderBrush = ThemeHelper.GetBorderPrimaryBrush(); // Windows 系统边框
|
||||
// 更新上下文菜单中的图标和文字颜色
|
||||
UpdateContextMenuTheme(MenuButtonContextMenu, true);
|
||||
}
|
||||
if (SettingsWindowTitle != null)
|
||||
{
|
||||
SettingsWindowTitle.Foreground = ThemeHelper.GetTextPrimaryBrush(); // Windows 系统主文字颜色
|
||||
}
|
||||
if (TopBarBorder != null)
|
||||
{
|
||||
TopBarBorder.Background = ThemeHelper.GetBackgroundPrimaryBrush(); // Windows 系统主背景
|
||||
}
|
||||
// 更新内部标题栏背景 - 使用直接访问而不是 FindDescendantByName
|
||||
// TopBarBackgroundBorder 是 TopBarBorder 的直接子元素
|
||||
if (TopBarBorder != null && TopBarBorder.Child is Border topBarBackgroundBorder)
|
||||
{
|
||||
topBarBackgroundBorder.Background = ThemeHelper.GetBackgroundPrimaryBrush(); // Windows 系统主背景
|
||||
}
|
||||
// 如果上面的方法找不到,尝试使用 FindDescendantByName 作为备用
|
||||
var topBarBackgroundBorderFallback = this.FindDescendantByName("TopBarBackgroundBorder") as Border;
|
||||
if (topBarBackgroundBorderFallback != null)
|
||||
{
|
||||
topBarBackgroundBorderFallback.Background = ThemeHelper.GetBackgroundPrimaryBrush(); // Windows 系统主背景
|
||||
}
|
||||
|
||||
// 更新侧边栏项目文本颜色
|
||||
foreach (var item in SidebarItems)
|
||||
{
|
||||
// 通过反射或直接访问来更新文本颜色
|
||||
// 这里需要在 XAML 中绑定或通过其他方式更新
|
||||
}
|
||||
|
||||
// 更新滚动条样式 - 参考 Windows 系统设置
|
||||
var scrollBarTrack = this.FindDescendantByName("ScrollBarBorderTrackBackground") as Border;
|
||||
if (scrollBarTrack != null)
|
||||
{
|
||||
scrollBarTrack.Background = ThemeHelper.GetScrollBarTrackBrush(); // Windows 系统滚动条轨道
|
||||
scrollBarTrack.Opacity = 0.3;
|
||||
}
|
||||
|
||||
// 更新侧边栏项目主题
|
||||
foreach (var item in SidebarItems)
|
||||
{
|
||||
item.IsDarkTheme = true;
|
||||
}
|
||||
CollectionViewSource.GetDefaultView(SidebarItems).Refresh();
|
||||
|
||||
// 更新图标颜色
|
||||
UpdateIconColors(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 浅色主题(默认)
|
||||
if (MainBorder != null)
|
||||
{
|
||||
MainBorder.Background = new SolidColorBrush(Color.FromRgb(250, 250, 250));
|
||||
MainBorder.BorderBrush = new SolidColorBrush(Color.FromRgb(53, 132, 228));
|
||||
}
|
||||
if (SidebarBorder != null)
|
||||
{
|
||||
SidebarBorder.Background = new SolidColorBrush(Color.FromRgb(235, 235, 235));
|
||||
SidebarBorder.BorderBrush = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
}
|
||||
if (SearchButtonBorder != null)
|
||||
{
|
||||
SearchButtonBorder.Background = new SolidColorBrush(Color.FromRgb(217, 217, 217));
|
||||
// 更新搜索按钮图标颜色
|
||||
UpdateButtonIconColor(SearchButtonBorder, false);
|
||||
}
|
||||
if (MenuButtonBorder != null)
|
||||
{
|
||||
MenuButtonBorder.Background = new SolidColorBrush(Color.FromRgb(217, 217, 217));
|
||||
// 更新菜单按钮图标颜色
|
||||
UpdateButtonIconColor(MenuButtonBorder, false);
|
||||
}
|
||||
if (TitleTextBlock != null)
|
||||
{
|
||||
TitleTextBlock.Foreground = new SolidColorBrush(Color.FromRgb(46, 52, 54));
|
||||
}
|
||||
if (MenuButtonContextMenu != null)
|
||||
{
|
||||
MenuButtonContextMenu.Background = new SolidColorBrush(Color.FromRgb(255, 255, 255));
|
||||
MenuButtonContextMenu.BorderBrush = new SolidColorBrush(Color.FromRgb(211, 211, 211));
|
||||
// 更新上下文菜单中的图标和文字颜色
|
||||
UpdateContextMenuTheme(MenuButtonContextMenu, false);
|
||||
}
|
||||
if (SettingsWindowTitle != null)
|
||||
{
|
||||
SettingsWindowTitle.Foreground = new SolidColorBrush(Color.FromRgb(46, 52, 54));
|
||||
}
|
||||
if (TopBarBorder != null)
|
||||
{
|
||||
TopBarBorder.Background = new SolidColorBrush(Color.FromRgb(250, 250, 250));
|
||||
}
|
||||
// 更新内部标题栏背景 - 使用直接访问而不是 FindDescendantByName
|
||||
// TopBarBackgroundBorder 是 TopBarBorder 的直接子元素
|
||||
if (TopBarBorder != null && TopBarBorder.Child is Border topBarBackgroundBorder)
|
||||
{
|
||||
topBarBackgroundBorder.Background = new SolidColorBrush(Color.FromRgb(250, 250, 250));
|
||||
}
|
||||
// 如果上面的方法找不到,尝试使用 FindDescendantByName 作为备用
|
||||
var topBarBackgroundBorderFallback = this.FindDescendantByName("TopBarBackgroundBorder") as Border;
|
||||
if (topBarBackgroundBorderFallback != null)
|
||||
{
|
||||
topBarBackgroundBorderFallback.Background = new SolidColorBrush(Color.FromRgb(250, 250, 250));
|
||||
}
|
||||
|
||||
// 更新滚动条样式
|
||||
var scrollBarTrack = this.FindDescendantByName("ScrollBarBorderTrackBackground") as Border;
|
||||
if (scrollBarTrack != null)
|
||||
{
|
||||
scrollBarTrack.Background = ThemeHelper.GetScrollBarTrackBrush(); // Windows 系统滚动条轨道
|
||||
scrollBarTrack.Opacity = 0;
|
||||
}
|
||||
|
||||
// 更新侧边栏项目主题
|
||||
foreach (var item in SidebarItems)
|
||||
{
|
||||
item.IsDarkTheme = false;
|
||||
}
|
||||
CollectionViewSource.GetDefaultView(SidebarItems).Refresh();
|
||||
|
||||
// 更新图标颜色
|
||||
UpdateIconColors(false);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新所有图标颜色以适配主题
|
||||
/// </summary>
|
||||
private void UpdateIconColors(bool isDarkTheme)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 根据主题选择颜色
|
||||
Color iconColor = isDarkTheme
|
||||
? Color.FromRgb(243, 243, 243) // 深色主题使用浅色图标 #F3F3F3
|
||||
: Color.FromRgb(34, 34, 34); // 浅色主题使用深色图标 #222222
|
||||
|
||||
// 更新每个侧边栏项目的图标
|
||||
foreach (var item in SidebarItems)
|
||||
{
|
||||
if (item.IconSource is DrawingImage drawingImage &&
|
||||
drawingImage.Drawing is DrawingGroup drawingGroup)
|
||||
{
|
||||
// 克隆并更新图标
|
||||
var clonedDrawing = CloneDrawingGroup(drawingGroup, iconColor);
|
||||
item.IconSource = new DrawingImage { Drawing = clonedDrawing };
|
||||
}
|
||||
}
|
||||
|
||||
CollectionViewSource.GetDefaultView(SidebarItems).Refresh();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"更新图标颜色时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 克隆 DrawingGroup 并更新颜色
|
||||
/// </summary>
|
||||
private DrawingGroup CloneDrawingGroup(DrawingGroup source, Color newColor)
|
||||
{
|
||||
var cloned = new DrawingGroup();
|
||||
cloned.ClipGeometry = source.ClipGeometry?.Clone();
|
||||
cloned.Opacity = source.Opacity;
|
||||
cloned.Transform = source.Transform?.Clone();
|
||||
|
||||
foreach (var drawing in source.Children)
|
||||
{
|
||||
if (drawing is GeometryDrawing geometryDrawing)
|
||||
{
|
||||
var clonedGeometry = geometryDrawing.Geometry?.Clone();
|
||||
var clonedBrush = CloneBrush(geometryDrawing.Brush, newColor);
|
||||
var clonedPen = geometryDrawing.Pen != null
|
||||
? ClonePen(geometryDrawing.Pen, newColor)
|
||||
: null;
|
||||
|
||||
cloned.Children.Add(new GeometryDrawing(clonedBrush, clonedPen, clonedGeometry));
|
||||
}
|
||||
else if (drawing is DrawingGroup subGroup)
|
||||
{
|
||||
cloned.Children.Add(CloneDrawingGroup(subGroup, newColor));
|
||||
}
|
||||
else
|
||||
{
|
||||
// 对于其他类型的 Drawing,尝试克隆
|
||||
cloned.Children.Add(drawing);
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
return new SolidColorBrush(newColor) { Opacity = solidBrush.Opacity };
|
||||
}
|
||||
else if (originalColor.A > 0 && originalColor != Colors.Transparent &&
|
||||
originalColor.R < 50 && originalColor.G < 50 && originalColor.B < 50) // 深色
|
||||
{
|
||||
return new SolidColorBrush(newColor) { Opacity = solidBrush.Opacity };
|
||||
}
|
||||
// 保持其他颜色不变(如透明色)
|
||||
return new SolidColorBrush(originalColor) { Opacity = solidBrush.Opacity };
|
||||
}
|
||||
return source?.Clone();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 克隆 Pen 并更新颜色
|
||||
/// </summary>
|
||||
private Pen ClonePen(Pen source, Color newColor)
|
||||
{
|
||||
var clonedBrush = CloneBrush(source.Brush, newColor);
|
||||
return new Pen(clonedBrush, source.Thickness)
|
||||
{
|
||||
StartLineCap = source.StartLineCap,
|
||||
EndLineCap = source.EndLineCap,
|
||||
LineJoin = source.LineJoin,
|
||||
MiterLimit = source.MiterLimit
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新上下文菜单的主题(图标和文字颜色)
|
||||
/// </summary>
|
||||
private void UpdateContextMenuTheme(ContextMenu contextMenu, bool isDarkTheme)
|
||||
{
|
||||
try
|
||||
{
|
||||
Color iconColor = isDarkTheme
|
||||
? Color.FromRgb(243, 243, 243) // 深色主题使用浅色图标 #F3F3F3
|
||||
: Color.FromRgb(34, 34, 34); // 浅色主题使用深色图标 #222222
|
||||
|
||||
foreach (var item in contextMenu.Items)
|
||||
{
|
||||
if (item is MenuItem menuItem)
|
||||
{
|
||||
// 更新文字颜色
|
||||
menuItem.Foreground = ThemeHelper.GetTextPrimaryBrush();
|
||||
|
||||
// 更新图标颜色
|
||||
if (menuItem.Icon is Image iconImage && iconImage.Source is DrawingImage drawingImage)
|
||||
{
|
||||
if (drawingImage.Drawing is DrawingGroup drawingGroup)
|
||||
{
|
||||
var clonedDrawing = CloneDrawingGroup(drawingGroup, iconColor);
|
||||
iconImage.Source = new DrawingImage { Drawing = clonedDrawing };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"更新上下文菜单主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新按钮中的图标颜色
|
||||
/// </summary>
|
||||
private void UpdateButtonIconColor(Border buttonBorder, bool isDarkTheme)
|
||||
{
|
||||
try
|
||||
{
|
||||
Color iconColor = isDarkTheme
|
||||
? Color.FromRgb(243, 243, 243) // 深色主题使用浅色图标 #F3F3F3
|
||||
: Color.FromRgb(34, 34, 34); // 浅色主题使用深色图标 #222222
|
||||
|
||||
// 查找按钮中的 Image 控件
|
||||
var image = FindVisualChild<Image>(buttonBorder);
|
||||
if (image != null && image.Source is DrawingImage drawingImage)
|
||||
{
|
||||
if (drawingImage.Drawing is DrawingGroup drawingGroup)
|
||||
{
|
||||
var clonedDrawing = CloneDrawingGroup(drawingGroup, iconColor);
|
||||
image.Source = new DrawingImage { Drawing = clonedDrawing };
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"更新按钮图标颜色时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 在视觉树中查找指定类型的子元素
|
||||
/// </summary>
|
||||
private T FindVisualChild<T>(DependencyObject parent) where T : DependencyObject
|
||||
{
|
||||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(parent); i++)
|
||||
{
|
||||
var child = VisualTreeHelper.GetChild(parent, i);
|
||||
if (child is T result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
var childOfChild = FindVisualChild<T>(child);
|
||||
if (childOfChild != null)
|
||||
{
|
||||
return childOfChild;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查系统主题是否为浅色
|
||||
/// </summary>
|
||||
private bool IsSystemThemeLight()
|
||||
{
|
||||
try
|
||||
{
|
||||
var registryKey = Microsoft.Win32.Registry.CurrentUser;
|
||||
var themeKey = registryKey.OpenSubKey("software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize");
|
||||
var keyValue = 0;
|
||||
if (themeKey != null) keyValue = (int)themeKey.GetValue("SystemUsesLightTheme");
|
||||
return keyValue == 1;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return true; // 默认返回浅色主题
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载所有设置面板的设置
|
||||
/// </summary>
|
||||
private void LoadAllPanelsSettings()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 预加载所有面板,确保它们在显示前都已初始化
|
||||
// 使用 Dispatcher.BeginInvoke 延迟执行,确保所有面板都已创建
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
// 所有设置面板列表
|
||||
var allPanels = new UserControl[]
|
||||
{
|
||||
StartupPanel,
|
||||
CanvasAndInkPanel,
|
||||
GesturesPanel,
|
||||
InkRecognitionPanel,
|
||||
ThemePanel,
|
||||
ShortcutsPanel,
|
||||
CrashActionPanel,
|
||||
PowerPointPanel,
|
||||
AutomationPanel,
|
||||
LuckyRandomPanel,
|
||||
StoragePanel,
|
||||
SnapshotPanel,
|
||||
AdvancedPanel,
|
||||
SettingsAboutPanel,
|
||||
AppearancePanel
|
||||
};
|
||||
|
||||
// 预加载所有面板:调用 LoadSettings、EnableTouchSupport 和 ApplyTheme
|
||||
foreach (var panel in allPanels)
|
||||
{
|
||||
if (panel != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 直接调用 LoadSettings 确保设置被加载
|
||||
var loadSettingsMethod = panel.GetType().GetMethod("LoadSettings",
|
||||
System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
|
||||
if (loadSettingsMethod != null)
|
||||
{
|
||||
loadSettingsMethod.Invoke(panel, null);
|
||||
}
|
||||
|
||||
// 调用 EnableTouchSupport 确保触摸支持已启用
|
||||
var enableTouchSupportMethod = panel.GetType().GetMethod("EnableTouchSupport",
|
||||
System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
|
||||
if (enableTouchSupportMethod != null)
|
||||
{
|
||||
enableTouchSupportMethod.Invoke(panel, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果面板没有 EnableTouchSupport 方法,直接使用 MainWindowSettingsHelper
|
||||
MainWindowSettingsHelper.EnableTouchSupportForControls(panel);
|
||||
}
|
||||
|
||||
// 调用 ApplyTheme 确保主题已应用
|
||||
var applyThemeMethod = panel.GetType().GetMethod("ApplyTheme",
|
||||
System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
|
||||
if (applyThemeMethod != null)
|
||||
{
|
||||
applyThemeMethod.Invoke(panel, null);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"预加载面板 {panel?.GetType().Name} 时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 再次应用主题到所有面板,确保主题完全加载
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
ApplyThemeToAllPanels();
|
||||
}), System.Windows.Threading.DispatcherPriority.Loaded);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"预加载所有面板时出错: {ex.Message}");
|
||||
}
|
||||
}), System.Windows.Threading.DispatcherPriority.Loaded);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"加载设置面板设置时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -268,13 +842,37 @@ namespace Ink_Canvas.Windows
|
||||
Separator
|
||||
}
|
||||
|
||||
public class SidebarItem
|
||||
public class SidebarItem : System.ComponentModel.INotifyPropertyChanged
|
||||
{
|
||||
public SidebarItemType Type { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Name { get; set; }
|
||||
public ImageSource IconSource { get; set; }
|
||||
public bool Selected { get; set; }
|
||||
private bool _selected = false;
|
||||
private bool _isDarkTheme = false;
|
||||
|
||||
public bool Selected
|
||||
{
|
||||
get => _selected;
|
||||
set
|
||||
{
|
||||
_selected = value;
|
||||
OnPropertyChanged(nameof(_siBackground));
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsDarkTheme
|
||||
{
|
||||
get => _isDarkTheme;
|
||||
set
|
||||
{
|
||||
_isDarkTheme = value;
|
||||
OnPropertyChanged(nameof(_siForeground));
|
||||
OnPropertyChanged(nameof(_siBackground));
|
||||
OnPropertyChanged(nameof(_spStroke));
|
||||
}
|
||||
}
|
||||
|
||||
public Visibility _spVisibility
|
||||
{
|
||||
get => Type == SidebarItemType.Separator ? Visibility.Visible : Visibility.Collapsed;
|
||||
@@ -286,9 +884,36 @@ namespace Ink_Canvas.Windows
|
||||
|
||||
public SolidColorBrush _siBackground
|
||||
{
|
||||
get => Selected
|
||||
? new SolidColorBrush(Color.FromRgb(217, 217, 217))
|
||||
: new SolidColorBrush(Colors.Transparent);
|
||||
get
|
||||
{
|
||||
if (Selected)
|
||||
{
|
||||
return _isDarkTheme
|
||||
? ThemeHelper.GetSelectedBackgroundBrush() // Windows 系统选中背景 #3E3E3E
|
||||
: new SolidColorBrush(Color.FromRgb(237, 237, 237));
|
||||
}
|
||||
return new SolidColorBrush(Colors.Transparent);
|
||||
}
|
||||
}
|
||||
|
||||
public SolidColorBrush _siForeground
|
||||
{
|
||||
get => _isDarkTheme
|
||||
? ThemeHelper.GetTextPrimaryBrush() // Windows 系统主文字颜色 #F3F3F3
|
||||
: new SolidColorBrush(Color.FromRgb(0, 0, 0));
|
||||
}
|
||||
|
||||
public SolidColorBrush _spStroke
|
||||
{
|
||||
get => _isDarkTheme
|
||||
? ThemeHelper.GetSeparatorBrush() // Windows 系统分隔线 #3E3E3E
|
||||
: new SolidColorBrush(Color.FromRgb(237, 237, 237));
|
||||
}
|
||||
|
||||
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
|
||||
protected virtual void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,7 +936,37 @@ namespace Ink_Canvas.Windows
|
||||
}
|
||||
}
|
||||
CollectionViewSource.GetDefaultView(SidebarItems).Refresh();
|
||||
|
||||
// 确保主题状态同步
|
||||
bool isDarkTheme = MainWindow.Settings?.Appearance != null &&
|
||||
(MainWindow.Settings.Appearance.Theme == 1 ||
|
||||
(MainWindow.Settings.Appearance.Theme == 2 && !IsSystemThemeLight()));
|
||||
foreach (var si in SidebarItems)
|
||||
{
|
||||
si.IsDarkTheme = isDarkTheme;
|
||||
}
|
||||
|
||||
// 定义面板映射
|
||||
var panelMappings = new Dictionary<string, UserControl>
|
||||
{
|
||||
{ "AboutItem", SettingsAboutPanel },
|
||||
{ "CanvasAndInkItem", CanvasAndInkPanel },
|
||||
{ "GesturesItem", GesturesPanel },
|
||||
{ "StartupItem", StartupPanel },
|
||||
{ "ThemeItem", ThemePanel },
|
||||
{ "ShortcutsItem", ShortcutsPanel },
|
||||
{ "CrashActionItem", CrashActionPanel },
|
||||
{ "InkRecognitionItem", InkRecognitionPanel },
|
||||
{ "AutomationItem", AutomationPanel },
|
||||
{ "PowerPointItem", PowerPointPanel },
|
||||
{ "LuckyRandomItem", LuckyRandomPanel },
|
||||
{ "StorageItem", StoragePanel },
|
||||
{ "SnapshotItem", SnapshotPanel },
|
||||
{ "AdvancedItem", AdvancedPanel },
|
||||
{ "AppearanceItem", AppearancePanel }
|
||||
};
|
||||
|
||||
// 设置面板可见性并应用主题
|
||||
if (AboutPane != null) AboutPane.Visibility = _selectedSidebarItemName == "AboutItem" ? Visibility.Visible : Visibility.Collapsed;
|
||||
if (CanvasAndInkPane != null) CanvasAndInkPane.Visibility = _selectedSidebarItemName == "CanvasAndInkItem" ? Visibility.Visible : Visibility.Collapsed;
|
||||
if (GesturesPane != null) GesturesPane.Visibility = _selectedSidebarItemName == "GesturesItem" ? Visibility.Visible : Visibility.Collapsed;
|
||||
@@ -326,6 +981,31 @@ namespace Ink_Canvas.Windows
|
||||
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 (panelMappings.ContainsKey(_selectedSidebarItemName))
|
||||
{
|
||||
var selectedPanel = panelMappings[_selectedSidebarItemName];
|
||||
if (selectedPanel != null)
|
||||
{
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var applyThemeMethod = selectedPanel.GetType().GetMethod("ApplyTheme",
|
||||
System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
|
||||
if (applyThemeMethod != null)
|
||||
{
|
||||
applyThemeMethod.Invoke(selectedPanel, null);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"切换面板时应用主题到 {selectedPanel.GetType().Name} 时出错: {ex.Message}");
|
||||
}
|
||||
}), System.Windows.Threading.DispatcherPriority.Loaded);
|
||||
}
|
||||
}
|
||||
if (SettingsPaneScrollViewers != null)
|
||||
{
|
||||
foreach (var sv in SettingsPaneScrollViewers)
|
||||
@@ -490,7 +1170,74 @@ namespace Ink_Canvas.Windows
|
||||
|
||||
private void MenuButton_Click(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
// 菜单功能 - 可以显示上下文菜单或选项菜单
|
||||
// 切换上下文菜单的显示状态
|
||||
if (MenuButtonContextMenu != null)
|
||||
{
|
||||
MenuButtonContextMenu.PlacementTarget = MenuButtonBorder;
|
||||
MenuButtonContextMenu.Placement = System.Windows.Controls.Primitives.PlacementMode.Bottom;
|
||||
|
||||
// 如果菜单已打开,则关闭;如果已关闭,则打开
|
||||
bool isCurrentlyOpen = MenuButtonContextMenu.IsOpen;
|
||||
|
||||
if (isCurrentlyOpen)
|
||||
{
|
||||
// 如果菜单已打开,直接关闭
|
||||
MenuButtonContextMenu.IsOpen = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果菜单未打开,打开菜单
|
||||
MenuButtonContextMenu.IsOpen = true;
|
||||
}
|
||||
|
||||
// 标记事件已处理,防止菜单拦截点击
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void MenuItemExit_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// 关闭设置窗口
|
||||
Close();
|
||||
|
||||
// 调用主窗口的退出方法
|
||||
if (_mainWindow != null)
|
||||
{
|
||||
_mainWindow.BtnExit_Click(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void MenuItemRestart_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// 关闭设置窗口
|
||||
Close();
|
||||
|
||||
// 调用主窗口的重启方法
|
||||
if (_mainWindow != null)
|
||||
{
|
||||
_mainWindow.BtnRestart_Click(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void MenuItemReset_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// 调用主窗口的重置配置方法
|
||||
if (_mainWindow != null)
|
||||
{
|
||||
_mainWindow.BtnResetToSuggestion_Click(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void MenuItemSwitchToOldSettings_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// 关闭新设置窗口
|
||||
Close();
|
||||
|
||||
// 调用主窗口的显示老设置面板方法
|
||||
if (_mainWindow != null)
|
||||
{
|
||||
_mainWindow.ShowOldSettingsPanel();
|
||||
}
|
||||
}
|
||||
|
||||
private void ToggleSwitch_Click(object sender, MouseButtonEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user