Share via


DispatcherExtensions.StartTimer Method

Definition

Starts a timer on the specified IDispatcher context.

public:
[System::Runtime::CompilerServices::Extension]
 static void StartTimer(Microsoft::Maui::Dispatching::IDispatcher ^ dispatcher, TimeSpan interval, Func<bool> ^ callback);
public static void StartTimer (this Microsoft.Maui.Dispatching.IDispatcher dispatcher, TimeSpan interval, Func<bool> callback);
static member StartTimer : Microsoft.Maui.Dispatching.IDispatcher * TimeSpan * Func<bool> -> unit
<Extension()>
Public Sub StartTimer (dispatcher As IDispatcher, interval As TimeSpan, callback As Func(Of Boolean))

Parameters

dispatcher
IDispatcher

The IDispatcher instance this method is called on.

interval
TimeSpan

Sets the amount of time between timer ticks.

callback
Func<Boolean>

The callback on which the dispatcher returns when the event is dispatched. If the result of the callback is true, the timer will repeat, otherwise the timer stops.

Exceptions

Thrown when callback is null.

Applies to