From a7b861f83c5d73423c722c3038d3e9c48299899b Mon Sep 17 00:00:00 2001 From: CJKmkp <2564608840@qq.com> Date: Fri, 25 Jul 2025 10:21:55 +0800 Subject: [PATCH] =?UTF-8?q?improve:PPT=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ink Canvas/MainWindow_cs/MW_PPT.cs | 37 ++++++++++++------ ...vasForClass.csproj.AssemblyReference.cache | Bin 35374 -> 35237 bytes 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/Ink Canvas/MainWindow_cs/MW_PPT.cs b/Ink Canvas/MainWindow_cs/MW_PPT.cs index a5051eef..4db96d73 100644 --- a/Ink Canvas/MainWindow_cs/MW_PPT.cs +++ b/Ink Canvas/MainWindow_cs/MW_PPT.cs @@ -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(); } } diff --git a/Ink Canvas/obj/Debug/net472/InkCanvasForClass.csproj.AssemblyReference.cache b/Ink Canvas/obj/Debug/net472/InkCanvasForClass.csproj.AssemblyReference.cache index 4af914e22079d93b58f0e03491291464a0dba41e..007dd88682c1e146a5e6a6e4853914122d4656c7 100644 GIT binary patch delta 23 ecmZ2Cg=y(zCJr`6T?PgQ#>B~j@}V1JJvsqL(gqX& delta 70 zcmZ2FnQ7e=CJr`6Jq88_#>B~j@}V1JJvt{RD27kAm*kqv$IYhXte29L!^j9!!0^EF X#&?CQ93Zt^WhQzCdd3FEhL#KfgtieT