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. using System;
  13. namespace Wayne.Lib.StateEngine
  14. {
  15. /// <summary>
  16. /// Final state represent an endpoint in a state machine. There can not be any transitions from this state to any other state in the
  17. /// same state machine. There can be several final states in
  18. /// one state machine. When the Final state has been reached, and after the Entry, the state engine
  19. /// will automatically post a BasicTransitionTypes.Done transition to the state machine above the state machine
  20. /// containing the final state.
  21. /// </summary>
  22. [EnterDescription("", BasicTransitionType.Done)]
  23. abstract public class FinalState : State
  24. {
  25. /// <summary>
  26. /// Override to add Enter code to the Final State.
  27. /// </summary>
  28. /// <param name="stateEntry">Information about the state entry.</param>
  29. /// <param name="transition">Set to a transition object to perform a transition.</param>
  30. protected override void Enter(StateEntry stateEntry, ref Transition transition)
  31. {
  32. base.Enter(stateEntry, ref transition);
  33. //If this is the final state in the root state machine, fire the OnFinalStateEntered event.
  34. if (this.ParentStateMachine.ParentStateMachine == null)
  35. this.ParentStateMachine.FireFinalStateEntered();
  36. transition = new Transition(this, BasicTransitionType.Done);
  37. }
  38. }
  39. }