From 06af63a10a614611399e550392b59b5ce39b88e1 Mon Sep 17 00:00:00 2001 From: CJKmkp <2564608840@qq.com> Date: Sat, 10 Jan 2026 21:16:12 +0800 Subject: [PATCH] =?UTF-8?q?add:PPT=E8=81=94=E5=8A=A8=E5=A4=87=E7=94=A8?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ink Canvas/Helpers/PPTManager.cs | 88 ++++++++++++++++---------------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/Ink Canvas/Helpers/PPTManager.cs b/Ink Canvas/Helpers/PPTManager.cs index d57464aa..0241bcd0 100644 --- a/Ink Canvas/Helpers/PPTManager.cs +++ b/Ink Canvas/Helpers/PPTManager.cs @@ -519,51 +519,51 @@ namespace Ink_Canvas.Helpers catch { } } } - - PPTApplication = null; - CurrentPresentation = null; - CurrentSlides = null; - CurrentSlide = null; - SlidesCount = 0; - - GC.Collect(); - GC.WaitForPendingFinalizers(); - GC.Collect(); - - _isModuleUnloading = true; - _connectionCheckTimer?.Stop(); - _slideShowStateCheckTimer?.Stop(); - - // 触发连接断开事件 - PPTConnectionChanged?.Invoke(false); - - LogHelper.WriteLogToFile("已断开PPT连接,暂时卸载模块以确保COM完全释放", LogHelper.LogType.Event); - - ThreadPool.QueueUserWorkItem(_ => - { - try - { - Thread.Sleep(2000); - - GC.Collect(); - GC.WaitForPendingFinalizers(); - GC.Collect(); - - Thread.Sleep(1000); - - _isModuleUnloading = false; - _connectionCheckTimer?.Start(); - _slideShowStateCheckTimer?.Start(); - - LogHelper.WriteLogToFile("PPT联动模块已重新加载", LogHelper.LogType.Trace); - } - catch (Exception ex) - { - LogHelper.WriteLogToFile($"重新加载PPT联动模块失败: {ex}", LogHelper.LogType.Error); - _isModuleUnloading = false; - } - }); } + + PPTApplication = null; + CurrentPresentation = null; + CurrentSlides = null; + CurrentSlide = null; + SlidesCount = 0; + + GC.Collect(); + GC.WaitForPendingFinalizers(); + GC.Collect(); + + _isModuleUnloading = true; + _connectionCheckTimer?.Stop(); + _slideShowStateCheckTimer?.Stop(); + + // 触发连接断开事件 + PPTConnectionChanged?.Invoke(false); + + LogHelper.WriteLogToFile("已断开PPT连接,暂时卸载模块以确保COM完全释放", LogHelper.LogType.Event); + + ThreadPool.QueueUserWorkItem(_ => + { + try + { + Thread.Sleep(2000); + + GC.Collect(); + GC.WaitForPendingFinalizers(); + GC.Collect(); + + Thread.Sleep(1000); + + _isModuleUnloading = false; + _connectionCheckTimer?.Start(); + _slideShowStateCheckTimer?.Start(); + + LogHelper.WriteLogToFile("PPT联动模块已重新加载", LogHelper.LogType.Trace); + } + catch (Exception ex) + { + LogHelper.WriteLogToFile($"重新加载PPT联动模块失败: {ex}", LogHelper.LogType.Error); + _isModuleUnloading = false; + } + }); } catch (Exception ex) {