Esempio n. 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);
            }
        }
Esempio n. 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);
        }
Esempio n. 3
0
 public ErrorTransition(BaseErrorState next)
 {
     this.Next = next;
 }
Esempio n. 4
0
		public ErrorTransition(BaseErrorState next)
		{
			this.Next = next;
		}
		public TransitionToErrorState(BaseErrorState errorState, Exception exception)
		{
			this.exception = exception;
			base.AddErrorTransition(new ErrorTransition(errorState), exception);
		}