using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ComponentModel; using FlyADBase; using FLY.Thick.Base.Common; using FLY.Thick.Base.IService; using System.Diagnostics; namespace FLY.Thick.Base.Server { public abstract class GM_Base : IGageMode { /// <summary> /// 参数异常 /// </summary> public const byte ERRNO_Running_Manual = 4; #region IGageMode 接口 public CTRL_STATE GMState { get; protected set; } /// <summary> /// 运行中 /// </summary> public bool IsRunning { get; protected set; } #endregion protected IFlyADClientAdv mFlyAD; protected FObjBase.PollModule.PollHandler onpoll_func; public GM_Base() { } public virtual void Init(IFlyADClientAdv flyad) { mFlyAD = flyad; onpoll_func = new FObjBase.PollModule.PollHandler(OnPoll); } protected virtual void OnPoll() { if (mFlyAD.IsFinish) { Stop(); } } #region IGageMode 接口 public virtual void Start() { if (IsRunning) { return; } if (!mFlyAD.IsConnected) { return; } IsRunning = true; FObjBase.PollModule.Current.Poll_Config(onpoll_func); } public virtual void Stop() { FObjBase.PollModule.Current.Poll_Config( FObjBase.PollModule.POLL_CONFIG.REMOVE, onpoll_func); IsRunning = false; } #endregion #region IGageMode 接口 protected void NotifyPropertyChanged(string propertyName) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; #endregion } }