improve:ROT模块
This commit is contained in:
@@ -460,6 +460,12 @@ namespace Ink_Canvas.Helpers
|
|||||||
{
|
{
|
||||||
Thread.Sleep(2000);
|
Thread.Sleep(2000);
|
||||||
|
|
||||||
|
if (_disposed)
|
||||||
|
{
|
||||||
|
_isModuleUnloading = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
GC.Collect();
|
GC.Collect();
|
||||||
GC.WaitForPendingFinalizers();
|
GC.WaitForPendingFinalizers();
|
||||||
GC.Collect();
|
GC.Collect();
|
||||||
@@ -467,7 +473,18 @@ namespace Ink_Canvas.Helpers
|
|||||||
Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
|
|
||||||
_isModuleUnloading = false;
|
_isModuleUnloading = false;
|
||||||
_unifiedPptTimer?.Start();
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!_disposed)
|
||||||
|
{
|
||||||
|
_unifiedPptTimer?.Start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ObjectDisposedException)
|
||||||
|
{
|
||||||
|
LogHelper.WriteLogToFile("PPT联动模块重载时计时器已释放,跳过重启", LogHelper.LogType.Trace);
|
||||||
|
}
|
||||||
|
|
||||||
LogHelper.WriteLogToFile("PPT联动模块已重新加载", LogHelper.LogType.Trace);
|
LogHelper.WriteLogToFile("PPT联动模块已重新加载", LogHelper.LogType.Trace);
|
||||||
}
|
}
|
||||||
|
|||||||
+3122
-788
File diff suppressed because it is too large
Load Diff
@@ -724,23 +724,13 @@ namespace Ink_Canvas
|
|||||||
LogHelper.WriteLogToFile("PPT连接已断开", LogHelper.LogType.Event);
|
LogHelper.WriteLogToFile("PPT连接已断开", LogHelper.LogType.Event);
|
||||||
_singlePPTInkManager?.ClearAllStrokes();
|
_singlePPTInkManager?.ClearAllStrokes();
|
||||||
_exitPPTModeAfterDisconnectTimer?.Stop();
|
_exitPPTModeAfterDisconnectTimer?.Stop();
|
||||||
_exitPPTModeAfterDisconnectTimer = new DispatcherTimer
|
_exitPPTModeAfterDisconnectTimer = null;
|
||||||
{
|
_pptUIManager?.UpdateSlideShowStatus(false);
|
||||||
Interval = TimeSpan.FromMilliseconds(ExitPPTModeAfterDisconnectDelayMs)
|
_pptUIManager?.UpdateSidebarExitButtons(false);
|
||||||
};
|
ResetPPTStateVariables();
|
||||||
_exitPPTModeAfterDisconnectTimer.Tick += (s, e) =>
|
_ = HandleManualSlideShowEnd();
|
||||||
{
|
if (Settings.PowerPointSettings.UseRotPptLink)
|
||||||
_exitPPTModeAfterDisconnectTimer?.Stop();
|
_pptManager?.ReloadConnection();
|
||||||
_exitPPTModeAfterDisconnectTimer = null;
|
|
||||||
if (_pptManager?.IsConnected != true)
|
|
||||||
{
|
|
||||||
_pptUIManager?.UpdateSlideShowStatus(false);
|
|
||||||
_pptUIManager?.UpdateSidebarExitButtons(false);
|
|
||||||
ResetPPTStateVariables();
|
|
||||||
_ = HandleManualSlideShowEnd();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
_exitPPTModeAfterDisconnectTimer.Start();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -921,14 +911,36 @@ namespace Ink_Canvas
|
|||||||
string presentationName = null;
|
string presentationName = null;
|
||||||
Presentation activePresentation = null;
|
Presentation activePresentation = null;
|
||||||
|
|
||||||
if (wn?.View != null && wn.Presentation != null)
|
if (wn != null)
|
||||||
{
|
{
|
||||||
activePresentation = wn.Presentation;
|
try
|
||||||
currentSlide = wn.View.CurrentShowPosition;
|
{
|
||||||
totalSlides = activePresentation.Slides.Count;
|
if (wn.View != null && wn.Presentation != null)
|
||||||
presentationName = activePresentation.Name;
|
{
|
||||||
|
activePresentation = wn.Presentation;
|
||||||
|
currentSlide = wn.View.CurrentShowPosition;
|
||||||
|
totalSlides = activePresentation.Slides.Count;
|
||||||
|
presentationName = activePresentation.Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (activePresentation == null)
|
||||||
{
|
{
|
||||||
activePresentation = _pptManager?.GetCurrentActivePresentation() as Presentation;
|
activePresentation = _pptManager?.GetCurrentActivePresentation() as Presentation;
|
||||||
currentSlide = _pptManager?.GetCurrentSlideNumber() ?? 0;
|
currentSlide = _pptManager?.GetCurrentSlideNumber() ?? 0;
|
||||||
@@ -1134,10 +1146,41 @@ namespace Ink_Canvas
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (wn?.View == null || wn.Presentation == null) return;
|
int currentSlide = 0;
|
||||||
|
int totalSlides = 0;
|
||||||
|
|
||||||
int currentSlide = wn.View.CurrentShowPosition;
|
if (wn != null)
|
||||||
int totalSlides = wn.Presentation.Slides.Count;
|
{
|
||||||
|
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;
|
if (currentSlide == _previousSlideID) return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user