StateChangedEventArgs.cs 1.6 KB

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