Ejemplo n.º 1
0
        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;
            }
        }
Ejemplo n.º 2
0
 public void OnClockTick(string id, StateChangeType lastStateChange, DateTime timestamp, TimeSpan elapsed)
 {
     if (DoesExist)
     {
         Instance.OnClockTick(id, lastStateChange, timestamp, elapsed);
     }
 }
Ejemplo n.º 3
0
        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();
            }
        }
Ejemplo n.º 4
0
        /// <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);
        }
Ejemplo n.º 5
0
 public void OnIntervalStateChange(string id, StateChangeType change, DateTime timestamp, TimeSpan elapsed)
 {
     if (DoesExist)
     {
         Instance.OnIntervalStateChange(id, change, timestamp, elapsed);
     }
 }
Ejemplo n.º 6
0
 /// <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;
 }
Ejemplo n.º 7
0
        public UserState(string statusText, MdxScriptCommand command, StateChangeType changeType)
        {
            StatusText = statusText;

            if (command != null)
            {
                CommandNumber = command.CommandNumber;
            }
            else
            {
                CommandNumber = -1;
            }

            Command    = command;
            ChangeType = changeType;
        }
Ejemplo n.º 8
0
        /// <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);
        }
Ejemplo n.º 9
0
        // 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);
        }
Ejemplo n.º 10
0
 /// <summary>
 /// 应用新状态的修改
 /// </summary>
 /// <param name="newState">新状态</param>
 /// <param name="changeType">状态变换种类</param>
 /// <returns>应用是否成功</returns>
 protected bool Apply(MaskManagerState newState, StateChangeType changeType)
 {
     return(Apply(newState, changeType, false));
 }
Ejemplo n.º 11
0
 /// <summary>
 /// 设置初始掩码状态
 /// </summary>
 /// <param name="newState"></param>
 protected void SetInitialState(MaskManagerState newState)
 {
     backupState  = null;
     currentState = newState;
     backupType   = StateChangeType.Terminator;
 }
Ejemplo n.º 12
0
 public StateChangeEventArgs(StateChangeType?stateChangeType = null)
 {
     StateChangeType = stateChangeType ?? StateChangeType.Multiple;
 }
Ejemplo n.º 13
0
 /// <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;
 }
Ejemplo n.º 14
0
 public ImageState(GameImage image, StateChangeType changeType) : this(new List <GameImage>() { image }, changeType)
 {
 }
Ejemplo n.º 15
0
 public virtual void OnIntervalStateChange(string id, StateChangeType change, DateTime timestamp, TimeSpan elapsed)
 {
 }
Ejemplo n.º 16
0
 public UserState(string statusText, StateChangeType changeType) : this(statusText, null, changeType)
 {
 }
Ejemplo n.º 17
0
 public override void OnClockTick(string id, StateChangeType lastStateChange, DateTime timestamp, TimeSpan elapsed)
 {
     _plugins.ForEach(plugin => plugin.OnClockTick(id, lastStateChange, timestamp, elapsed));
 }
Ejemplo n.º 18
0
 /// <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;
 }
Ejemplo n.º 19
0
 public ImageState(IEnumerable <GameImage> image, StateChangeType changeType)
 {
     AddRange(image);
     SetImageChanger(changeType);
     Reset();
 }
Ejemplo n.º 20
0
 public override void OnIntervalStateChange(string id, StateChangeType change, DateTime timestamp, TimeSpan elapsed)
 {
     _plugins.ForEach(plugin => plugin.OnIntervalStateChange(id, change, timestamp, elapsed));
 }
Ejemplo n.º 21
0
 public virtual void OnClockTick(string id, StateChangeType lastStateChange, DateTime timestamp, TimeSpan elapsed)
 {
 }
Ejemplo n.º 22
0
 public UserState(MdxScriptCommand command, StateChangeType changeType) : this(null, command, changeType)
 {
 }
Ejemplo n.º 23
0
 public StateChangeEventArgs(StateChangeType? stateChangeType = null)
 {
     StateChangeType = stateChangeType ?? StateChangeType.Multiple;
 }