656863a7d0
* feat(docstring):添加docstring Signed-off-by: doudou0720 <98651603+doudou0720@users.noreply.github.com> * fix(docstring):修复部分docstring格式错误 Signed-off-by: doudou0720 <98651603+doudou0720@users.noreply.github.com> * fix(docstring):修复部分docstring Signed-off-by: doudou0720 <98651603+doudou0720@users.noreply.github.com> * chore(Docstring):MW_* 前14 * chore(Docstring):MW_* part 2 * chore(Docstring):MW_* part 3 * chore:优化缩进 * fix: 修复数学计算中的潜在除零错误和数值稳定性问题 Signed-off-by: doudou0720 <98651603+doudou0720@users.noreply.github.com> * chore:删除Rebase时多余的OOBE函数 * chore: 更新代码注释和文档格式 修复XML文档注释中的格式问题,统一使用<c>和<see>标签 更新ConfigHelper类的预留说明,明确未来扩展用途 优化TimerDisplayDate_Elapsed方法的注释,说明UI异步更新机制 合并重复的注释摘要行,提高文档可读性 添加形状识别功能的64位进程限制说明 修正视频呈现器设备选择逻辑的文档说明 * chore(IPPTLinkManager): 更新TryEndSlideShow方法的XML注释格式 * chore: 修正代码注释中的术语和格式问题 更新多个文件中的XML注释,统一使用<see langword="..."/>标记代替<c>...</c>标记 规范术语使用(如"延迟初始化"代替"懒惰初始化") 修正注释中的格式错误和补充说明 调整代码区域的注释对齐格式 --------- Signed-off-by: doudou0720 <98651603+doudou0720@users.noreply.github.com>
105 lines
3.7 KiB
C#
105 lines
3.7 KiB
C#
using System;
|
|
using Microsoft.Office.Interop.PowerPoint;
|
|
|
|
namespace Ink_Canvas.Helpers
|
|
{
|
|
public class ComPPTLinkManager : IPPTLinkManager
|
|
{
|
|
private readonly PPTManager _inner;
|
|
|
|
public ComPPTLinkManager()
|
|
{
|
|
_inner = new PPTManager();
|
|
|
|
_inner.SlideShowBegin += wn => SlideShowBegin?.Invoke(wn);
|
|
_inner.SlideShowNextSlide += wn => SlideShowNextSlide?.Invoke(wn);
|
|
_inner.SlideShowEnd += pres => SlideShowEnd?.Invoke(pres);
|
|
_inner.PresentationOpen += pres => PresentationOpen?.Invoke(pres);
|
|
_inner.PresentationClose += pres => PresentationClose?.Invoke(pres);
|
|
_inner.PPTConnectionChanged += connected => PPTConnectionChanged?.Invoke(connected);
|
|
_inner.SlideShowStateChanged += inSlideShow => SlideShowStateChanged?.Invoke(inSlideShow);
|
|
}
|
|
|
|
#region IPPTLinkManager 事件
|
|
public event Action<object> SlideShowBegin;
|
|
public event Action<object> SlideShowNextSlide;
|
|
public event Action<object> SlideShowEnd;
|
|
public event Action<object> PresentationOpen;
|
|
public event Action<object> PresentationClose;
|
|
public event Action<bool> PPTConnectionChanged;
|
|
public event Action<bool> SlideShowStateChanged;
|
|
#endregion
|
|
|
|
#region IPPTLinkManager 属性
|
|
public bool IsConnected => _inner.IsConnected;
|
|
|
|
public bool IsInSlideShow => _inner.IsInSlideShow;
|
|
|
|
public bool IsSupportWPS
|
|
{
|
|
get => _inner.IsSupportWPS;
|
|
set => _inner.IsSupportWPS = value;
|
|
}
|
|
|
|
public int SlidesCount => _inner.SlidesCount;
|
|
|
|
public object PPTApplication => _inner.PPTApplication;
|
|
#endregion
|
|
|
|
#region 生命周期管理
|
|
/// <summary>
|
|
/// 开始监控本地 PowerPoint 的连接与运行状态,并在状态变化时触发相应事件。
|
|
/// </summary>
|
|
public void StartMonitoring() => _inner.StartMonitoring();
|
|
|
|
/// <summary>
|
|
/// 停止对 PowerPoint 的监控,断开当前连接并停止触发相关事件。
|
|
/// </summary>
|
|
public void StopMonitoring() => _inner.StopMonitoring();
|
|
|
|
/// <summary>
|
|
/// 强制断开当前 COM PPT 连接并停止对其监控,同时写入事件日志。
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// 会向日志记录一条事件信息并调用内部管理器停止监控;该方法不会重新启动监控或重新初始化内部管理器实例。
|
|
/// </remarks>
|
|
public void ReloadConnection()
|
|
{
|
|
LogHelper.WriteLogToFile("COM PPT 执行热重载:强制断开并重新连接", LogHelper.LogType.Event);
|
|
_inner.StopMonitoring();
|
|
}
|
|
#endregion
|
|
|
|
#region 放映控制
|
|
public bool TryStartSlideShow() => _inner.TryStartSlideShow();
|
|
|
|
public bool TryEndSlideShow() => _inner.TryEndSlideShow();
|
|
#endregion
|
|
|
|
#region 导航控制
|
|
public bool TryNavigateToSlide(int slideNumber) => _inner.TryNavigateToSlide(slideNumber);
|
|
|
|
public bool TryNavigateNext() => _inner.TryNavigateNext();
|
|
|
|
public bool TryNavigatePrevious() => _inner.TryNavigatePrevious();
|
|
#endregion
|
|
|
|
#region 查询
|
|
public int GetCurrentSlideNumber() => _inner.GetCurrentSlideNumber();
|
|
|
|
public string GetPresentationName() => _inner.GetPresentationName();
|
|
|
|
public bool TryShowSlideNavigation() => _inner.TryShowSlideNavigation();
|
|
|
|
public object GetCurrentActivePresentation() => _inner.GetCurrentActivePresentation();
|
|
#endregion
|
|
|
|
#region IDisposable
|
|
public void Dispose()
|
|
{
|
|
_inner?.Dispose();
|
|
}
|
|
#endregion
|
|
}
|
|
}
|