add:安全中心

This commit is contained in:
2026-02-16 20:22:41 +08:00
parent 2f8c368eef
commit 45dc3cb537
18 changed files with 1167 additions and 49 deletions
+31 -2
View File
@@ -1388,7 +1388,7 @@ namespace Ink_Canvas
}
}
private void Window_Closing(object sender, CancelEventArgs e)
private async void Window_Closing(object sender, CancelEventArgs e)
{
LogHelper.WriteLogToFile("Ink Canvas closing", LogHelper.LogType.Event);
try
@@ -1400,6 +1400,23 @@ namespace Ink_Canvas
LogHelper.WriteLogToFile($"关闭快抽悬浮按钮时出错: {ex.Message}", LogHelper.LogType.Error);
}
try
{
if (!App.IsUpdateInstalling && SecurityManager.IsPasswordRequiredForExit(Settings))
{
bool ok = await SecurityManager.PromptAndVerifyAsync(Settings, this, "退出验证", "请输入安全密码以退出软件。");
if (!ok)
{
e.Cancel = true;
LogHelper.WriteLogToFile("Ink Canvas closing cancelled by security password", LogHelper.LogType.Event);
return;
}
}
}
catch
{
}
if (!CloseIsFromButton && Settings.Advanced.IsSecondConfirmWhenShutdownApp)
{
// 第一个确认对话框
@@ -2498,11 +2515,23 @@ namespace Ink_Canvas
#region
// 添加打开新设置窗口按钮点击事件
private void BtnOpenNewSettings_Click(object sender, RoutedEventArgs e)
private async void BtnOpenNewSettings_Click(object sender, RoutedEventArgs e)
{
if (isOpeningOrHidingSettingsPane) return;
HideSubPanels();
{
try
{
if (SecurityManager.IsPasswordRequiredForEnterSettings(Settings))
{
bool ok = await SecurityManager.PromptAndVerifyAsync(Settings, this, "进入设置", "请输入安全密码以进入设置。");
if (!ok) return;
}
}
catch
{
}
var settingsWindow = new SettingsWindow();
settingsWindow.Owner = this;
settingsWindow.ShowDialog();