/// <summary>
        /// Adds a state to the state machine.
        /// </summary>
        /// <param name="state">The state.</param>
        internal void AddState(StateMachineState <TState, TTransition, TPayload> state)
        {
            if (true == this.states.ContainsKey(state.State))
            {
                throw new ArgumentException($"The state machine has duplicate state '{state.State}' defined.");
            }

            this.states.Add(state.State, state);
        }
示例#2
0
 public StateMachineTransition(
     TTransition current,
     StateMachineBase <TState, TTransition, TPayload> stateMachine,
     StateMachineState <TState, TTransition, TPayload> startState,
     StateMachineState <TState, TTransition, TPayload> endState,
     IEnumerable <StateMachineTransitionDel <TState, TTransition, TPayload> > onTransitionDelegate)
 {
     this.stateMachine         = stateMachine;
     this.startState           = startState;
     this.endState             = endState;
     this.onTransitionDelegate = onTransitionDelegate.ToList();
     this.Message = current;
 }