FinalState.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #region --------------- Copyright Dresser Wayne Pignone -------------
  2. /*
  3. * $Log: /Wrk/WayneLibraries/Wrk/StateEngine/FinalState.cs $
  4. *
  5. * 4 08-02-26 14:07 Mattias.larsson
  6. * Removed Obsolete method.
  7. *
  8. * 3 07-03-02 13:19 roger.månsson
  9. * Removed CLSCompliant(false) attribute.
  10. */
  11. #endregion
  12. namespace Wayne.Lib.StateEngine
  13. {
  14. /// <summary>
  15. /// Final state represent an endpoint in a state machine. There can not be any transitions from this state to any other state in the
  16. /// same state machine. There can be several final states in
  17. /// one state machine. When the Final state has been reached, and after the Entry, the state engine
  18. /// will automatically post a BasicTransitionTypes.Done transition to the state machine above the state machine
  19. /// containing the final state.
  20. /// </summary>
  21. [EnterDescription("", BasicTransitionType.Done)]
  22. abstract public class FinalState : State
  23. {
  24. /// <summary>
  25. /// Override to add Enter code to the Final State.
  26. /// </summary>
  27. /// <param name="stateEntry">Information about the state entry.</param>
  28. /// <param name="transition">Set to a transition object to perform a transition.</param>
  29. protected override void Enter(StateEntry stateEntry, ref Transition transition)
  30. {
  31. base.Enter(stateEntry, ref transition);
  32. //If this is the final state in the root state machine, fire the OnFinalStateEntered event.
  33. if (this.ParentStateMachine.ParentStateMachine == null)
  34. this.ParentStateMachine.FireFinalStateEntered();
  35. transition = new Transition(this, BasicTransitionType.Done);
  36. }
  37. }
  38. }