#nullable enable using System.ComponentModel; namespace Terminal.Gui.App; #pragma warning disable CS1711 /// /// Provides data for events that can be cancelled without a changeable result in a cancellable workflow in the Cancellable Work Pattern (CWP). /// /// /// Used for workflows where a change (e.g., a simple property change) can be cancelled, but the /// value being changed is not directly modified by the event handlers. /// /// The type of the value that is being changed. /// /// public class CancelEventArgs : CancelEventArgs where T : notnull { /// Initializes a new instance of the class. /// The current (old) value of the property. /// The value the property will be set to if the event is not cancelled. /// Whether the event should be canceled or not. /// The type of the value for the change being canceled. public CancelEventArgs (ref readonly T currentValue, ref T newValue, bool cancel = false) : base (cancel) { CurrentValue = currentValue; NewValue = newValue; } /// /// Initializes a new instance of the class. /// /// The current (old) value of the property. /// The value the property will be set to if the event is not cancelled. protected CancelEventArgs (T currentValue, T newValue) { CurrentValue = currentValue; NewValue = newValue; } /// The current value of the property. public T CurrentValue { get; } /// The value the property will be set to if the event is not cancelled. public T NewValue { get; set; } }