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;
// 新增:用于控制WPS强制关闭提示只弹一次
private static bool hasShownWpsForceCloseWarning = false;
private void BtnCheckPPT_Click(object sender, RoutedEventArgs e) {
try {
pptApplication =
@@ -1473,20 +1476,29 @@ namespace Ink_Canvas {
if (!allSaved)
{
// 弹窗提示用户
bool userContinue = false;
Application.Current.Dispatcher.Invoke(() =>
// 弹窗提示用户(只弹一次)
if (!hasShownWpsForceCloseWarning)
{
var result = MessageBox.Show(
"检测到有未保存的WPS文档,强制关闭可能导致数据丢失。是否继续?",
"警告", MessageBoxButton.YesNo, MessageBoxImage.Warning);
userContinue = (result == MessageBoxResult.Yes);
});
if (!userContinue)
hasShownWpsForceCloseWarning = true;
bool userContinue = false;
Application.Current.Dispatcher.Invoke(() =>
{
var result = MessageBox.Show(
"检测到有未保存的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();
return;
// 已弹过,直接跳过或默认继续
LogHelper.WriteLogToFile("WPS强制关闭提示已弹出,自动继续。", LogHelper.LogType.Trace);
}
}
@@ -1531,6 +1543,7 @@ namespace Ink_Canvas {
}
finally
{
hasShownWpsForceCloseWarning = false; // 复位,便于下次检测
StopWppProcessCheckTimer();
}
}