improve:PPT模块

This commit is contained in:
2025-07-25 10:21:55 +08:00
parent 19b1c7ae8b
commit a7b861f83c
2 changed files with 25 additions and 12 deletions
+25 -12
View File
@@ -81,6 +81,9 @@ namespace Ink_Canvas {
// 在类中添加字段 // 在类中添加字段
private bool wasFloatingBarFoldedWhenEnterSlideShow = false; private bool wasFloatingBarFoldedWhenEnterSlideShow = false;
// 新增:用于控制WPS强制关闭提示只弹一次
private static bool hasShownWpsForceCloseWarning = false;
private void BtnCheckPPT_Click(object sender, RoutedEventArgs e) { private void BtnCheckPPT_Click(object sender, RoutedEventArgs e) {
try { try {
pptApplication = pptApplication =
@@ -1473,20 +1476,29 @@ namespace Ink_Canvas {
if (!allSaved) if (!allSaved)
{ {
// 弹窗提示用户 // 弹窗提示用户(只弹一次)
bool userContinue = false; if (!hasShownWpsForceCloseWarning)
Application.Current.Dispatcher.Invoke(() =>
{ {
var result = MessageBox.Show( hasShownWpsForceCloseWarning = true;
"检测到有未保存的WPS文档,强制关闭可能导致数据丢失。是否继续?", bool userContinue = false;
"警告", MessageBoxButton.YesNo, MessageBoxImage.Warning); Application.Current.Dispatcher.Invoke(() =>
userContinue = (result == MessageBoxResult.Yes); {
}); var result = MessageBox.Show(
if (!userContinue) "检测到有未保存的WPS文档,强制关闭可能导致数据丢失。是否继续?",
"警告", MessageBoxButton.YesNo, MessageBoxImage.Warning);
userContinue = (result == MessageBoxResult.Yes);
});
if (!userContinue)
{
LogHelper.WriteLogToFile("用户取消了强制关闭WPS进程", LogHelper.LogType.Trace);
StopWppProcessCheckTimer();
return;
}
}
else
{ {
LogHelper.WriteLogToFile("用户取消了强制关闭WPS进程", LogHelper.LogType.Trace); // 已弹过,直接跳过或默认继续
StopWppProcessCheckTimer(); LogHelper.WriteLogToFile("WPS强制关闭提示已弹出,自动继续。", LogHelper.LogType.Trace);
return;
} }
} }
@@ -1531,6 +1543,7 @@ namespace Ink_Canvas {
} }
finally finally
{ {
hasShownWpsForceCloseWarning = false; // 复位,便于下次检测
StopWppProcessCheckTimer(); StopWppProcessCheckTimer();
} }
} }