Class DebouncerBase<TEventArgs>
This class implements the IDebouncerBase<TEventArgs> interface.
public abstract class DebouncerBase<TEventArgs> : IDebouncerBase<TEventArgs>, IDisposable where TEventArgs : DebouncedEventArgs
Type Parameters
TEventArgs
- Inheritance
-
DebouncerBase<TEventArgs>
- Implements
-
IDebouncerBase<TEventArgs>
- Derived
- Inherited Members
Properties
CurrentEventHandlersTask
Gets an awaitable Task running any current event handlers.
public Task CurrentEventHandlersTask { get; }
Property Value
DebounceTimeout
Gets or sets the maximum TimeSpan since the first Trigger() after which a new Debounced event will fire.
public TimeSpan DebounceTimeout { get; set; }
Property Value
Exceptions
- ObjectDisposedException
The object has been disposed.
DebounceWindow
public TimeSpan DebounceWindow { get; set; }
Property Value
Exceptions
- ObjectDisposedException
The object has been disposed.
EventSpacing
public TimeSpan EventSpacing { get; set; }
Property Value
Exceptions
- ObjectDisposedException
The object has been disposed.
HandlerSpacing
Gets or sets the minimum TimeSpan between the end of one Debounced event handler invocation and the start of the next.
public TimeSpan HandlerSpacing { get; set; }
Property Value
Exceptions
- ObjectDisposedException
The object has been disposed.
TimingGranularity
Gets or sets the TimeSpan within which multiple calls to Trigger() will be coalesced without rescheduling the timer.
public TimeSpan TimingGranularity { get; set; }
Property Value
Exceptions
- ObjectDisposedException
The object has been disposed.
Methods
Dispose()
See Dispose()
public void Dispose()
Dispose(bool)
Releases the unmanaged resources and optionally releases the managed resources.
protected virtual void Dispose(bool disposing)
Parameters
disposingbooltrue to release both managed and unmanaged resources; false to release only unmanaged resources.
Reset()
Resets the accumulated trigger count to 0 and cancels any ongoing debouncing.
public long Reset()
Returns
- long
The number of triggers that had been accumulated since the last event handler was called.
Remarks
This method may be called even after Dispose() has been called.
Trigger()
Accumulates one more trigger.
public void Trigger()
Exceptions
- ObjectDisposedException
The object has been disposed.
Events
Debounced
This event will be sent when Trigger() has been called one or more times and the debounce timer times out.
public event EventHandler<TEventArgs>? Debounced
Event Type
- EventHandler<TEventArgs>