Skip to main content

DispatcherTimer Class

NuGet: GHIElectronics.TinyCLR.UI
Assembly: GHIElectronics.TinyCLR.UI
Namespace: GHIElectronics.TinyCLR.UI.Threading

A timer that is integrated into the Dispatcher queues, and will be processed after a given amount of time

public class DispatcherTimer : IDisposable

Constructors​

DispatcherTimer()​

public DispatcherTimer() : this(Dispatcher.CurrentDispatcher)

Creates a timer that uses the current thread's Dispatcher to process the timer event

DispatcherTimer(Dispatcher dispatcher)​

public DispatcherTimer(Dispatcher dispatcher)

Creates a timer that uses the specified Dispatcher to process the timer event.

ParameterTypeDescription
dispatcherDispatcherThe dispatcher to use to process the timer.

Properties​

Dispatcher​

public Dispatcher Dispatcher { get; }

Gets the dispatcher this timer is associated with.

IsEnabled​

public bool IsEnabled { get; set; }

Gets or sets whether the timer is running.

Interval​

public TimeSpan Interval { get; set; }

Gets or sets the time between timer ticks.

Tag​

public object Tag { get; set; }

Any data that the caller wants to pass along with the timer.

Methods​

Start()​

public void Start()

Starts the timer.

Stop()​

public void Stop()

Stops the timer.

Close()​

public virtual void Close()

Stops the timer and releases its resources.

Dispose()​

public void Dispose()

Releases all resources used by the timer.

Dispose(bool disposing)​

protected virtual void Dispose(bool disposing)

Releases the resources used by the timer.

Events​

Tick​

public event EventHandler Tick

Occurs when the specified timer interval has elapsed and the timer is enabled.