improve:ROT模块
This commit is contained in:
@@ -460,6 +460,12 @@ namespace Ink_Canvas.Helpers
|
||||
{
|
||||
Thread.Sleep(2000);
|
||||
|
||||
if (_disposed)
|
||||
{
|
||||
_isModuleUnloading = false;
|
||||
return;
|
||||
}
|
||||
|
||||
GC.Collect();
|
||||
GC.WaitForPendingFinalizers();
|
||||
GC.Collect();
|
||||
@@ -467,7 +473,18 @@ namespace Ink_Canvas.Helpers
|
||||
Thread.Sleep(1000);
|
||||
|
||||
_isModuleUnloading = false;
|
||||
|
||||
try
|
||||
{
|
||||
if (!_disposed)
|
||||
{
|
||||
_unifiedPptTimer?.Start();
|
||||
}
|
||||
}
|
||||
catch (ObjectDisposedException)
|
||||
{
|
||||
LogHelper.WriteLogToFile("PPT联动模块重载时计时器已释放,跳过重启", LogHelper.LogType.Trace);
|
||||
}
|
||||
|
||||
LogHelper.WriteLogToFile("PPT联动模块已重新加载", LogHelper.LogType.Trace);
|
||||
}
|
||||
|
||||
+3030
-696
File diff suppressed because it is too large
Load Diff
@@ -723,24 +723,14 @@ namespace Ink_Canvas
|
||||
{
|
||||
LogHelper.WriteLogToFile("PPT连接已断开", LogHelper.LogType.Event);
|
||||
_singlePPTInkManager?.ClearAllStrokes();
|
||||
_exitPPTModeAfterDisconnectTimer?.Stop();
|
||||
_exitPPTModeAfterDisconnectTimer = new DispatcherTimer
|
||||
{
|
||||
Interval = TimeSpan.FromMilliseconds(ExitPPTModeAfterDisconnectDelayMs)
|
||||
};
|
||||
_exitPPTModeAfterDisconnectTimer.Tick += (s, e) =>
|
||||
{
|
||||
_exitPPTModeAfterDisconnectTimer?.Stop();
|
||||
_exitPPTModeAfterDisconnectTimer = null;
|
||||
if (_pptManager?.IsConnected != true)
|
||||
{
|
||||
_pptUIManager?.UpdateSlideShowStatus(false);
|
||||
_pptUIManager?.UpdateSidebarExitButtons(false);
|
||||
ResetPPTStateVariables();
|
||||
_ = HandleManualSlideShowEnd();
|
||||
}
|
||||
};
|
||||
_exitPPTModeAfterDisconnectTimer.Start();
|
||||
if (Settings.PowerPointSettings.UseRotPptLink)
|
||||
_pptManager?.ReloadConnection();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -921,14 +911,36 @@ namespace Ink_Canvas
|
||||
string presentationName = null;
|
||||
Presentation activePresentation = null;
|
||||
|
||||
if (wn?.View != null && wn.Presentation != null)
|
||||
if (wn != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (wn.View != null && wn.Presentation != null)
|
||||
{
|
||||
activePresentation = wn.Presentation;
|
||||
currentSlide = wn.View.CurrentShowPosition;
|
||||
totalSlides = activePresentation.Slides.Count;
|
||||
presentationName = activePresentation.Name;
|
||||
}
|
||||
else
|
||||
}
|
||||
catch (COMException comEx)
|
||||
{
|
||||
var hr = (uint)comEx.HResult;
|
||||
activePresentation = null;
|
||||
currentSlide = 0;
|
||||
totalSlides = 0;
|
||||
presentationName = null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
activePresentation = null;
|
||||
currentSlide = 0;
|
||||
totalSlides = 0;
|
||||
presentationName = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (activePresentation == null)
|
||||
{
|
||||
activePresentation = _pptManager?.GetCurrentActivePresentation() as Presentation;
|
||||
currentSlide = _pptManager?.GetCurrentSlideNumber() ?? 0;
|
||||
@@ -1134,10 +1146,41 @@ namespace Ink_Canvas
|
||||
{
|
||||
try
|
||||
{
|
||||
if (wn?.View == null || wn.Presentation == null) return;
|
||||
int currentSlide = 0;
|
||||
int totalSlides = 0;
|
||||
|
||||
int currentSlide = wn.View.CurrentShowPosition;
|
||||
int totalSlides = wn.Presentation.Slides.Count;
|
||||
if (wn != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (wn.View != null)
|
||||
{
|
||||
currentSlide = wn.View.CurrentShowPosition;
|
||||
}
|
||||
}
|
||||
catch (COMException comEx)
|
||||
{
|
||||
var hr = (uint)comEx.HResult;
|
||||
LogHelper.WriteLogToFile(
|
||||
$"通过 SlideShowWindow.View 获取当前页失败: {comEx.Message} (HR: 0x{hr:X8}),将回退到 PPT 管理器获取",
|
||||
LogHelper.LogType.Warning);
|
||||
currentSlide = 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile(
|
||||
$"通过 SlideShowWindow.View 获取当前页时发生异常,将回退到 PPT 管理器获取: {ex}",
|
||||
LogHelper.LogType.Warning);
|
||||
currentSlide = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentSlide <= 0)
|
||||
{
|
||||
currentSlide = _pptManager?.GetCurrentSlideNumber() ?? 0;
|
||||
}
|
||||
|
||||
totalSlides = _pptManager?.SlidesCount ?? 0;
|
||||
|
||||
if (currentSlide == _previousSlideID) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user