StateEventArgs.cs 914 B

123456789101112131415161718192021222324252627
  1. #nullable enable
  2. using System.ComponentModel;
  3. namespace Terminal.Gui;
  4. /// <summary><see cref="EventArgs"/> for events that convey state changes to a <see cref="View"/> class.</summary>
  5. /// <remarks>
  6. /// Events that use this class can be cancellable. The <see cref="CancelEventArgs.Cancel"/> property should be set to
  7. /// <see langword="true"/> to prevent the state change from occurring.
  8. /// </remarks>
  9. public class StateEventArgs<T> : CancelEventArgs
  10. {
  11. /// <summary>Creates a new instance of the <see cref="StateEventArgs{T}"/> class.</summary>
  12. /// <param name="oldValue"></param>
  13. /// <param name="newValue"></param>
  14. public StateEventArgs (T oldValue, T newValue)
  15. {
  16. OldValue = oldValue;
  17. NewValue = newValue;
  18. }
  19. /// <summary>The new state</summary>
  20. public T NewValue { get; set; }
  21. /// <summary>The previous state</summary>
  22. public T OldValue { get; }
  23. }