示例#1
0
        private void SetErrorState(Error error)
        {
            if (!this.CheckIsRunning())
            {
                return;
            }
            if (this.IsCurrentStateEndErrorState())
            {
                this.StopStateMachine();
                this.RaiseStateMachineErroredEvent(error);
                return;
            }
            BaseErrorState baseErrorState = this.CurrentState.NextErrorState(error);

            if (baseErrorState != this.CurrentState)
            {
                this.CurrentState.Stop();
                this.CurrentState.Finished -= new EventHandler <TransitionEventArgs>(this.CurrentStateFinished);
                this.CurrentState.Errored  -= new EventHandler <Error>(this.CurrentStateErrored);
                this.CurrentState           = baseErrorState;
                baseErrorState.Finished    += new EventHandler <TransitionEventArgs>(this.CurrentStateFinished);
                baseErrorState.Errored     += new EventHandler <Error>(this.CurrentStateErrored);
                baseErrorState.Start(error);
            }
        }
示例#2
0
        private BaseState HandleTransitionException(BaseState state, Exception exception)
        {
            Error          error          = new Error(exception);
            BaseErrorState baseErrorState = this.NextErrorState(error);

            if (baseErrorState != null)
            {
                baseErrorState.Start(error);
                state = baseErrorState;
            }
            return(state);
        }
示例#3
0
 public ErrorTransition(BaseErrorState next)
 {
     this.Next = next;
 }
示例#4
0
		public ErrorTransition(BaseErrorState next)
		{
			this.Next = next;
		}
		public TransitionToErrorState(BaseErrorState errorState, Exception exception)
		{
			this.exception = exception;
			base.AddErrorTransition(new ErrorTransition(errorState), exception);
		}