Exemplo n.º 1
0
 public StateMachine(State initialState)
 {
     pCurrentSubState = initialState;
     pActivationTimer.AutoReset = true;
     pActivationTimer.Elapsed += PActivationTimerElapsed;
     pActivationTimer.Start();
 }
Exemplo n.º 2
0
Arquivo: State.cs Projeto: antgraf/BA
 public virtual State HandleEvent(int eventId)
 {
     // TODO add events
     State newState = null;
     try
     {
         newState = HandleEventCustom(eventId);
     }
     catch(Exception e)
     {
         HandleError(e);
     }
     if(newState == null)
     {
         newState = _HandleEvent(eventId);
     }
     if(newState == null && pCurrentSubState != null)
     {
         State newSubState = pCurrentSubState.HandleEvent(eventId);
         if(newSubState != null)
         {
             ChangeSubState(pCurrentSubState, newSubState);
             pCurrentSubState = newSubState;
         }
     }
     return newState;
 }
Exemplo n.º 3
0
Arquivo: State.cs Projeto: antgraf/BA
 private void ChangeSubState(State from, State to)
 {
     // TODO add events
     from._Leave();
     pCurrentSubState = to;
     to._Enter();
 }