Revert "add:新设置"

This reverts commit 63585911a7.
This commit is contained in:
2026-01-10 17:31:39 +08:00
parent 483e0757b7
commit 68a74be279
8 changed files with 51 additions and 166 deletions
@@ -1,8 +1,6 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using Ink_Canvas;
namespace Ink_Canvas.Windows.SettingsViews
{
@@ -11,13 +9,6 @@ namespace Ink_Canvas.Windows.SettingsViews
public CrashActionPanel()
{
InitializeComponent();
Loaded += CrashActionPanel_Loaded;
}
private void CrashActionPanel_Loaded(object sender, RoutedEventArgs e)
{
LoadSettings();
ApplyTheme();
}
public event EventHandler<RoutedEventArgs> IsTopBarNeedShadowEffect;
@@ -35,73 +26,17 @@ namespace Ink_Canvas.Windows.SettingsViews
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
}
}
public void LoadSettings()
{
try
{
if (App.CrashAction == App.CrashActionType.SilentRestart)
{
ThemeHelper.SetOptionButtonSelectedState(CrashActionSilentRestartBorder, true);
ThemeHelper.SetOptionButtonSelectedState(CrashActionNoActionBorder, false);
}
else
{
ThemeHelper.SetOptionButtonSelectedState(CrashActionSilentRestartBorder, false);
ThemeHelper.SetOptionButtonSelectedState(CrashActionNoActionBorder, true);
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine($"CrashActionPanel 加载设置时出错: {ex.Message}");
}
}
private void OptionButton_Click(object sender, MouseButtonEventArgs e)
{
var border = sender as Border;
if (border != null)
{
string tag = border.Tag?.ToString();
if (!string.IsNullOrEmpty(tag))
{
// 清除同组其他按钮的选中状态
if (tag == "CrashAction_SilentRestart")
{
ThemeHelper.SetOptionButtonSelectedState(CrashActionSilentRestartBorder, true);
ThemeHelper.SetOptionButtonSelectedState(CrashActionNoActionBorder, false);
App.CrashAction = App.CrashActionType.SilentRestart;
if (MainWindow.Settings?.Startup != null)
{
MainWindow.Settings.Startup.CrashAction = (int)App.CrashActionType.SilentRestart;
}
}
else if (tag == "CrashAction_NoAction")
{
ThemeHelper.SetOptionButtonSelectedState(CrashActionSilentRestartBorder, false);
ThemeHelper.SetOptionButtonSelectedState(CrashActionNoActionBorder, true);
App.CrashAction = App.CrashActionType.NoAction;
if (MainWindow.Settings?.Startup != null)
{
MainWindow.Settings.Startup.CrashAction = (int)App.CrashActionType.NoAction;
}
}
}
}
}
public void ApplyTheme()
{
try
{
ThemeHelper.ApplyThemeToControl(this);
// 重新应用按钮状态以适配主题
LoadSettings();
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine($"CrashActionPanel 应用主题时出错: {ex.Message}");
System.Diagnostics.Debug.WriteLine($"CrashActionPanel 应用主题时出? {ex.Message}");
}
}
}
}