ValueChangedEventArgs.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. namespace Terminal.Gui.App;
  2. /// <summary>
  3. /// Provides data for events that notify of a completed property change in the Cancellable Work Pattern (CWP).
  4. /// </summary>
  5. /// <remarks>
  6. /// <para>
  7. /// Used in post-change events raised by <see cref="CWPPropertyHelper.ChangeProperty{T}"/> to notify
  8. /// subscribers of a property change, such as in <see cref="OrientationHelper"/> when the
  9. /// <see cref="Orientation"/> property is updated or <see cref="View.SchemeName"/> when the scheme name changes.
  10. /// </para>
  11. /// </remarks>
  12. /// <typeparam name="T">The type of the property value, which may be a nullable reference type (e.g., <see cref="string"/>?).</typeparam>
  13. /// <seealso cref="ValueChangingEventArgs{T}"/>
  14. /// <seealso cref="CWPPropertyHelper"/>
  15. public class ValueChangedEventArgs<T>
  16. {
  17. /// <summary>
  18. /// Gets the value before the change, which may be null for nullable types.
  19. /// </summary>
  20. public T OldValue { get; }
  21. /// <summary>
  22. /// Gets the value after the change, which may be null for nullable types.
  23. /// </summary>
  24. public T NewValue { get; }
  25. /// <summary>
  26. /// Initializes a new instance of the <see cref="ValueChangedEventArgs{T}"/> class.
  27. /// </summary>
  28. /// <param name="oldValue">The value before the change, which may be null for nullable types.</param>
  29. /// <param name="newValue">The value after the change, which may be null for nullable types.</param>
  30. public ValueChangedEventArgs (T oldValue, T newValue)
  31. {
  32. OldValue = oldValue;
  33. NewValue = newValue;
  34. }
  35. }