improve:ROT联动
This commit is contained in:
@@ -268,8 +268,6 @@ namespace Ink_Canvas.Helpers
|
||||
|
||||
if (currentPriority > 0)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"ROT扫描: {displayName}: priority={currentPriority}", LogHelper.LogType.Trace);
|
||||
|
||||
if (currentPriority > highestPriority)
|
||||
{
|
||||
highestPriority = currentPriority;
|
||||
|
||||
@@ -200,14 +200,12 @@ namespace Ink_Canvas.Helpers
|
||||
if (_disposed) return;
|
||||
|
||||
_unifiedRotTimer?.Start();
|
||||
LogHelper.WriteLogToFile("[ROT] PPT 监控已启动", LogHelper.LogType.Trace);
|
||||
}
|
||||
|
||||
public void StopMonitoring()
|
||||
{
|
||||
_unifiedRotTimer?.Stop();
|
||||
DisconnectFromPPT();
|
||||
LogHelper.WriteLogToFile("[ROT] PPT 监控已停止", LogHelper.LogType.Trace);
|
||||
}
|
||||
|
||||
public void ReloadConnection()
|
||||
@@ -341,8 +339,6 @@ namespace Ink_Canvas.Helpers
|
||||
app.SlideShowBegin += OnSlideShowBeginInternal;
|
||||
app.SlideShowNextSlide += OnSlideShowNextSlideInternal;
|
||||
app.SlideShowEnd += OnSlideShowEndInternal;
|
||||
|
||||
LogHelper.WriteLogToFile("[ROT] PPT 事件注册成功", LogHelper.LogType.Trace);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -410,7 +406,6 @@ namespace Ink_Canvas.Helpers
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"[ROT] 取消 PPT 事件注册异常: {ex}", LogHelper.LogType.Warning);
|
||||
LogHelper.WriteLogToFile(ex.ToString(), LogHelper.LogType.Trace);
|
||||
}
|
||||
}, DispatcherPriority.Normal);
|
||||
}
|
||||
@@ -463,8 +458,6 @@ namespace Ink_Canvas.Helpers
|
||||
|
||||
_isModuleUnloading = false;
|
||||
_unifiedRotTimer?.Start();
|
||||
|
||||
LogHelper.WriteLogToFile("[ROT] PPT 联动模块已重新进入联动状态(热重载)", LogHelper.LogType.Trace);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -1514,7 +1514,7 @@
|
||||
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
|
||||
<Image Source="/Resources/Icons-png/Powerpoint.png" Margin="0,0,6,0" Width="28"
|
||||
Height="28" VerticalAlignment="Center" />
|
||||
<TextBlock Foreground="#fafafa" Text="使用 ROT 联动(需要重启)" VerticalAlignment="Center"
|
||||
<TextBlock Foreground="#fafafa" Text="使用 ROT 联动" VerticalAlignment="Center"
|
||||
FontSize="14" Margin="0,0,16,0" />
|
||||
<ui:ToggleSwitch OnContent="" OffContent="" Name="ToggleSwitchUseRotPptLink"
|
||||
IsOn="False" FontFamily="Microsoft YaHei UI" FontWeight="Bold"
|
||||
|
||||
@@ -102,6 +102,9 @@ namespace Ink_Canvas
|
||||
private int _pendingSlideIndex = -1;
|
||||
private System.Timers.Timer _slideSwitchDebounceTimer;
|
||||
private const int SlideSwitchDebounceMs = 150; // 防抖延迟150毫秒
|
||||
|
||||
private DispatcherTimer _exitPPTModeAfterDisconnectTimer;
|
||||
private const int ExitPPTModeAfterDisconnectDelayMs = 800;
|
||||
#endregion
|
||||
|
||||
#region PPT Managers
|
||||
@@ -573,12 +576,32 @@ namespace Ink_Canvas
|
||||
|
||||
if (isConnected)
|
||||
{
|
||||
_exitPPTModeAfterDisconnectTimer?.Stop();
|
||||
_exitPPTModeAfterDisconnectTimer = null;
|
||||
LogHelper.WriteLogToFile("PPT连接已建立", LogHelper.LogType.Event);
|
||||
}
|
||||
else
|
||||
{
|
||||
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();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user