Skip to main content

DispatcherTimer Class

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

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()

When overridden by a descendant class, closes the response stream. (inherited)

Dispose()

public void Dispose()

Releases buffered memory (the unmanaged firmware/application buffers). (inherited)

Dispose(bool disposing)

protected virtual void Dispose(bool disposing)

Closes a response stream, if present. (inherited)

ParameterTypeDescription
disposingboolNot used.

Events

Tick

public event EventHandler Tick

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