Table of Contents

Class DebouncerBase<TEventArgs>

Namespace
Dorssel.Utilities.Generic
Assembly
Dorssel.Utilities.Debounce.dll

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

Task

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

TimeSpan

Exceptions

ObjectDisposedException

The object has been disposed.

DebounceWindow

Gets or sets the TimeSpan within which new calls to Trigger() will restart the debounce timer.

public TimeSpan DebounceWindow { get; set; }

Property Value

TimeSpan

Exceptions

ObjectDisposedException

The object has been disposed.

EventSpacing

Gets or sets the minimum TimeSpan between two consecutive starts of the Debounced event.

public TimeSpan EventSpacing { get; set; }

Property Value

TimeSpan

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

TimeSpan

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

TimeSpan

Exceptions

ObjectDisposedException

The object has been disposed.

Methods

Dispose()

public void Dispose()

Dispose(bool)

Releases the unmanaged resources and optionally releases the managed resources.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

true 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>