StateChangedEventArgs.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System;
  2. namespace Wayne.Lib.StateEngine
  3. {
  4. /// <summary>
  5. /// Argument in the StateChanged events. It contains the new and the old state in a state transition.
  6. /// </summary>
  7. public class StateChangedEventArgs : EventArgs
  8. {
  9. #region Fields
  10. State oldState;
  11. State newState;
  12. Transition transition;
  13. #endregion
  14. #region Construction
  15. /// <summary>
  16. /// Constructor for the StateChanged Event Arguments
  17. /// </summary>
  18. /// <param name="oldState">The State object representing the state that was exited.</param>
  19. /// <param name="newState">The State object representing the state that was entered.</param>
  20. /// <param name="transition">The Transition.</param>
  21. public StateChangedEventArgs(State oldState, State newState, Transition transition)
  22. {
  23. this.oldState = oldState;
  24. this.newState = newState;
  25. this.transition = transition;
  26. }
  27. #endregion
  28. #region Properties
  29. /// <summary>
  30. /// The state that is exited
  31. /// </summary>
  32. public State OldState
  33. {
  34. get { return oldState; }
  35. }
  36. /// <summary>
  37. /// The new state that is entered.
  38. /// </summary>
  39. public State NewState
  40. {
  41. get { return newState; }
  42. }
  43. /// <summary>
  44. /// The Transition.
  45. /// </summary>
  46. public Transition Transition
  47. {
  48. get { return transition; }
  49. }
  50. #endregion
  51. }
  52. }