Dispatcher Class

Provides services for managing work items on a thread.

Definition

Namespace: Avalonia.Threading
Assembly: Avalonia.Base (in Avalonia.Base.dll) Version: 11.3.999
public class Dispatcher : IDispatcher
Inheritance
Object    Dispatcher
Implements
IDispatcher

Remarks

In Avalonia, there is usually only a single Dispatcher in the application - the one for the UI thread, retrieved via the UIThread property.

Properties

Methods

AwaitWithPriority(Task, DispatcherPriority) Returns a task awaitable that would invoke continuation on specified dispatcher priority
AwaitWithPriorityT(TaskT, DispatcherPriority) Returns a task awaitable that would invoke continuation on specified dispatcher priority
BeginInvokeShutdown(DispatcherPriority) Begins the process of shutting down the dispatcher.
CheckAccess Checks that the current thread is the UI thread.
DisableProcessing Disable the event processing of the dispatcher.
Equals(Object)Determines whether the specified object is equal to the current object.
(Inherited from Object)
ExitAllFrames Requests that all nested frames exit.
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetTypeGets the Type of the current instance.
(Inherited from Object)
HasJobsWithPriority(DispatcherPriority) 
Invoke(Action) Executes the specified Action synchronously on the thread that the Dispatcher was created on.
Invoke(Action, DispatcherPriority) Executes the specified Action synchronously on the thread that the Dispatcher was created on.
Invoke(Action, DispatcherPriority, CancellationToken) Executes the specified Action synchronously on the thread that the Dispatcher was created on.
Invoke(Action, DispatcherPriority, CancellationToken, TimeSpan) Executes the specified Action synchronously on the thread that the Dispatcher was created on.
InvokeTResult(FuncTResult) Executes the specified Func<TResult> synchronously on the thread that the Dispatcher was created on.
InvokeTResult(FuncTResult, DispatcherPriority) Executes the specified Func<TResult> synchronously on the thread that the Dispatcher was created on.
InvokeTResult(FuncTResult, DispatcherPriority, CancellationToken) Executes the specified Func<TResult> synchronously on the thread that the Dispatcher was created on.
InvokeTResult(FuncTResult, DispatcherPriority, CancellationToken, TimeSpan) Executes the specified Func<TResult> synchronously on the thread that the Dispatcher was created on.
InvokeAsync(Action) Executes the specified Action asynchronously on the thread that the Dispatcher was created on.
InvokeAsync(FuncTask) Executes the specified Func<Task> asynchronously on the thread that the Dispatcher was created on
InvokeAsync(Action, DispatcherPriority) Executes the specified Action asynchronously on the thread that the Dispatcher was created on.
InvokeAsync(FuncTask, DispatcherPriority) Executes the specified Func<Task> asynchronously on the thread that the Dispatcher was created on
InvokeAsync(Action, DispatcherPriority, CancellationToken) Executes the specified Action asynchronously on the thread that the Dispatcher was created on.
InvokeAsyncTResult(FuncTResult) Executes the specified Func<TResult> asynchronously on the thread that the Dispatcher was created on.
InvokeAsyncTResult(FuncTaskTResult) Executes the specified Func<Task<TResult>> asynchronously on the thread that the Dispatcher was created on
InvokeAsyncTResult(FuncTResult, DispatcherPriority) Executes the specified Func<TResult> asynchronously on the thread that the Dispatcher was created on.
InvokeAsyncTResult(FuncTaskTResult, DispatcherPriority) Executes the specified Func<Task<TResult>> asynchronously on the thread that the Dispatcher was created on
InvokeAsyncTResult(FuncTResult, DispatcherPriority, CancellationToken) Executes the specified Func<TResult> asynchronously on the thread that the Dispatcher was created on.
InvokeShutdown Initiates the shutdown process of the Dispatcher synchronously.
MainLoop(CancellationToken) Runs the dispatcher's main loop.
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Post(Action, DispatcherPriority) Posts an action that will be invoked on the dispatcher thread.
Post(SendOrPostCallback, Object, DispatcherPriority) Posts an action that will be invoked on the dispatcher thread.
PushFrame(DispatcherFrame) Push an execution frame.
RunJobs(NullableDispatcherPriority) Force-runs all dispatcher operations ignoring any pending OS events, use with caution
ToStringReturns a string that represents the current object.
(Inherited from Object)
VerifyAccess Checks that the current thread is the UI thread and throws if not.

Events

ShutdownFinished Raised when the dispatcher is shut down.
ShutdownStarted Raised when the dispatcher is shutting down.
UnhandledException Occurs when a thread exception is thrown and uncaught during execution of a delegate by way of Invoke(Action) or InvokeAsync(Action).
UnhandledExceptionFilter Occurs when a thread exception is thrown and uncaught during execution of a delegate by way of Invoke(Action) or InvokeAsync(Action) when in the filter stage.

See Also