public void MoveNext(MyInfoProcessCommands command) { MyInfoProcessState previewState = CurrentState; CurrentState = GetNext(command); if (this.MyRegistrationListener != null && previewState != CurrentState) { // MyRegistrationListener.onMyRegistrationStateChanged(CurrentState); } }
public MyInfoProcessState GetNext(MyInfoProcessCommands command) { StateTransition transition = new StateTransition(CurrentState, command); MyInfoProcessState nextState; if (!transitions.TryGetValue(transition, out nextState)) { throw new Exception("Invalid transition: " + CurrentState + " -> " + command); } return(nextState); }
public StateTransition(MyInfoProcessState currentState, MyInfoProcessCommands command) { CurrentState = currentState; Command = command; }