DispatcherInvokeTResult(FuncTResult, DispatcherPriority, CancellationToken, TimeSpan) Method

Executes the specified Func<TResult> synchronously on the thread that the Dispatcher was created on.

Definition

Namespace: Avalonia.Threading
Assembly: Avalonia.Base (in Avalonia.Base.dll) Version: 11.3.999
public TResult Invoke<TResult>(
	Func<TResult> callback,
	DispatcherPriority priority,
	CancellationToken cancellationToken,
	TimeSpan timeout
)

Parameters

callback  FuncTResult
A Func<TResult> delegate to invoke through the dispatcher.
priority  DispatcherPriority
The priority that determines in what order the specified callback is invoked relative to the other pending operations in the Dispatcher.
cancellationToken  CancellationToken
A cancellation token that can be used to cancel the operation. If the operation has not started, it will be aborted when the cancellation token is canceled. If the operation has started, the operation can cooperate with the cancellation request.
timeout  TimeSpan
The minimum amount of time to wait for the operation to start. Once the operation has started, it will complete before this method returns.

Type Parameters

TResult
The type of the callback return value.

Return Value

TResult
The return value from the delegate being invoked.

See Also