Files

118 lines
3.4 KiB
C#
Raw Permalink Normal View History

using System;
namespace Ink_Canvas.Helpers
{
public abstract class BasePPTLinkManager : IPPTLinkManager
{
#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 virtual bool IsConnected => PPTApplication != null;
public virtual bool IsInSlideShow { get; protected set; }
public virtual bool IsSupportWPS { get; set; }
public virtual bool SkipAnimationsWhenNavigating { get; set; }
public virtual int SlidesCount { get; protected set; }
public abstract object PPTApplication { get; protected set; }
#endregion
#region
protected BasePPTLinkManager()
{
}
#endregion
#region
public abstract void StartMonitoring();
public abstract void StopMonitoring();
public virtual void ReloadConnection()
{
LogHelper.WriteLogToFile($"{GetType().Name} 执行热重载:强制断开并重新连接", LogHelper.LogType.Event);
StopMonitoring();
}
#endregion
#region
public abstract bool TryStartSlideShow();
public abstract bool TryEndSlideShow();
#endregion
#region
public abstract bool TryNavigateToSlide(int slideNumber);
public abstract bool TryNavigateNext();
public abstract bool TryNavigatePrevious();
#endregion
#region
public abstract int GetCurrentSlideNumber();
public abstract string GetPresentationName();
public abstract bool TryShowSlideNavigation();
public abstract object GetCurrentActivePresentation();
#endregion
#region
protected virtual void OnSlideShowBegin(object slideShowWindow)
{
SlideShowBegin?.Invoke(slideShowWindow);
}
protected virtual void OnSlideShowNextSlide(object slideShowWindow)
{
SlideShowNextSlide?.Invoke(slideShowWindow);
}
protected virtual void OnSlideShowEnd(object presentation)
{
SlideShowEnd?.Invoke(presentation);
}
protected virtual void OnPresentationOpen(object presentation)
{
PresentationOpen?.Invoke(presentation);
}
protected virtual void OnPresentationClose(object presentation)
{
PresentationClose?.Invoke(presentation);
}
protected virtual void OnPPTConnectionChanged(bool isConnected)
{
PPTConnectionChanged?.Invoke(isConnected);
}
protected virtual void OnSlideShowStateChanged(bool isInSlideShow)
{
SlideShowStateChanged?.Invoke(isInSlideShow);
}
#endregion
#region IDisposable
public virtual void Dispose()
{
StopMonitoring();
}
#endregion
}
}