public void SetImageChanger(StateChangeType changeType) { switch (changeType) { case StateChangeType.None: ImageChanger = new StaticSequencer(); break; case StateChangeType.Alternating: ImageChanger = new AlternatingSequencer(Count - 1); break; case StateChangeType.Forwarding: ImageChanger = new ForwardingSequencer(Count - 1); break; case StateChangeType.Random: ImageChanger = new RandomSequencer(Count - 1); break; case StateChangeType.Repeating: ImageChanger = new RepeatingSequencer(Count - 1); break; default: ImageChanger = new StaticSequencer(); break; } }
public void OnClockTick(string id, StateChangeType lastStateChange, DateTime timestamp, TimeSpan elapsed) { if (DoesExist) { Instance.OnClockTick(id, lastStateChange, timestamp, elapsed); } }
public StateChange(byte[] buffer) { MemoryStream ms = new MemoryStream(buffer); BinaryReader br = new BinaryReader(ms); this.type = (StateChangeType)br.ReadByte(); byte nums = br.ReadByte(); for (int i = 0; i < nums; i++) { this.intProperties[(StateProperties)br.ReadByte()] = br.ReadInt32(); } nums = br.ReadByte(); for (int i = 0; i < nums; i++) { this.stringProperties[(StateProperties)br.ReadByte()] = br.ReadString(); } nums = br.ReadByte(); for (int i = 0; i < nums; i++) { this.doubleProperties[(StateProperties)br.ReadByte()] = br.ReadDouble(); } }
/// <summary> /// 应用新状态的修改 /// </summary> /// <param name="newState">新状态</param> /// <param name="changeType">状态变换种类</param> /// <param name="isNeededKeyCheck"></param> /// <returns>应用是否成功</returns> protected bool Apply(MaskManagerState newState, StateChangeType changeType, bool isNeededKeyCheck) { if (!IsValid(newState)) { return(false); } if (newState.IsSame(CurrentState)) { return(false); } string editText = GetEditText(newState); if (!isNeededKeyCheck) { if (GetCurrentEditText() != editText) { if (!RaiseEditTextChanging(editText)) { return(false); } ApplyInternal(newState, changeType); base.RaiseEditTextChanged(); } else { ApplyInternal(newState, changeType); } } return(true); }
public void OnIntervalStateChange(string id, StateChangeType change, DateTime timestamp, TimeSpan elapsed) { if (DoesExist) { Instance.OnIntervalStateChange(id, change, timestamp, elapsed); } }
/// <summary> /// 记录状态及状态变换类别 /// </summary> /// <param name="newState"></param> /// <param name="changeType"></param> void ApplyInternal(MaskManagerState newState, StateChangeType changeType) { if (backupType != changeType) { if (changeType != StateChangeType.Terminator) { backupState = currentState; } backupType = changeType; } currentState = newState; }
public UserState(string statusText, MdxScriptCommand command, StateChangeType changeType) { StatusText = statusText; if (command != null) { CommandNumber = command.CommandNumber; } else { CommandNumber = -1; } Command = command; ChangeType = changeType; }
/// <summary> /// 撤消操作 /// </summary> /// <returns></returns> public override bool Undo() { if (!CanUndo) { return(false); } if (!RaiseEditTextChanging(GetEditText(backupState))) { return(false); } backupType = StateChangeType.Terminator; MaskManagerState currentState = this.currentState; currentState = backupState; backupState = currentState; base.RaiseEditTextChanged(); return(true); }
// We ensure that our event is raised on the Automation thread .. (Eases concurrency issues in handling it, though it will get passed on to the main thread...) void OnStateChanged(StateChangeType stateChangeType) { StateChangeEventArgs stateChangedArgs; switch (stateChangeType) { case StateChangeType.Multiple: stateChangedArgs = s_stateChangeMultiple; break; case StateChangeType.Move: stateChangedArgs = s_stateChangeMove; break; case StateChangeType.TextChange: stateChangedArgs = s_stateChangeTextChange; break; default: throw new ArgumentOutOfRangeException(nameof(stateChangeType)); } StateChanged?.Invoke(this, stateChangedArgs); }
/// <summary> /// 应用新状态的修改 /// </summary> /// <param name="newState">新状态</param> /// <param name="changeType">状态变换种类</param> /// <returns>应用是否成功</returns> protected bool Apply(MaskManagerState newState, StateChangeType changeType) { return(Apply(newState, changeType, false)); }
/// <summary> /// 设置初始掩码状态 /// </summary> /// <param name="newState"></param> protected void SetInitialState(MaskManagerState newState) { backupState = null; currentState = newState; backupType = StateChangeType.Terminator; }
public StateChangeEventArgs(StateChangeType?stateChangeType = null) { StateChangeType = stateChangeType ?? StateChangeType.Multiple; }
/// <summary> /// Creates a new NavigationStateChangedEventArgs instance given the frame the event pertains to and the change that occurred. /// </summary> /// <param name="frameFacade">The frame that is raising the event.</param> /// <param name="stateChange">The type of state change that occurred.</param> public NavigationStateChangedEventArgs(IFrameFacade frameFacade, StateChangeType stateChange) { _frameFacadeWeakRef = new WeakReference<IFrameFacade>(frameFacade); StateChange = stateChange; }
public ImageState(GameImage image, StateChangeType changeType) : this(new List <GameImage>() { image }, changeType) { }
public virtual void OnIntervalStateChange(string id, StateChangeType change, DateTime timestamp, TimeSpan elapsed) { }
public UserState(string statusText, StateChangeType changeType) : this(statusText, null, changeType) { }
public override void OnClockTick(string id, StateChangeType lastStateChange, DateTime timestamp, TimeSpan elapsed) { _plugins.ForEach(plugin => plugin.OnClockTick(id, lastStateChange, timestamp, elapsed)); }
/// <summary> /// Creates a new NavigationStateChangedEventArgs instance given the frame the event pertains to and the change that occurred. /// </summary> /// <param name="frameFacade">The frame that is raising the event.</param> /// <param name="stateChange">The type of state change that occurred.</param> public NavigationStateChangedEventArgs(IFrameFacade frameFacade, StateChangeType stateChange) { _frameFacadeWeakRef = new WeakReference <IFrameFacade>(frameFacade); StateChange = stateChange; }
public ImageState(IEnumerable <GameImage> image, StateChangeType changeType) { AddRange(image); SetImageChanger(changeType); Reset(); }
public override void OnIntervalStateChange(string id, StateChangeType change, DateTime timestamp, TimeSpan elapsed) { _plugins.ForEach(plugin => plugin.OnIntervalStateChange(id, change, timestamp, elapsed)); }
public virtual void OnClockTick(string id, StateChangeType lastStateChange, DateTime timestamp, TimeSpan elapsed) { }
public UserState(MdxScriptCommand command, StateChangeType changeType) : this(null, command, changeType) { }
public StateChangeEventArgs(StateChangeType? stateChangeType = null) { StateChangeType = stateChangeType ?? StateChangeType.Multiple; }