Dispatcher Class
Provides services for managing work items on a thread.
Definition
Namespace: Avalonia.Threading
Assembly: Avalonia.Base (in Avalonia.Base.dll)
- C#
- VB
- F#
public class Dispatcher : IDispatcher
Public Class Dispatcher
Implements IDispatcher
type Dispatcher =
class
interface IDispatcher
end
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
SupportsRunLoops | |
UIThread |
Methods
AwaitWithPriority(Task, DispatcherPriority) | Returns a task awaitable that would invoke continuation on specified dispatcher priority |
AwaitWithPriority(T)(Task(T), 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. |
Finalize() | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object) |
GetHashCode() | Serves as the default hash function. (Inherited from Object) |
GetType() | Gets 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. |
Invoke(TResult)(Func(TResult)) | Executes the specified Func<TResult> synchronously on the thread that the Dispatcher was created on. |
Invoke(TResult)(Func(TResult), DispatcherPriority) | Executes the specified Func<TResult> synchronously on the thread that the Dispatcher was created on. |
Invoke(TResult)(Func(TResult), DispatcherPriority, CancellationToken) | Executes the specified Func<TResult> synchronously on the thread that the Dispatcher was created on. |
Invoke(TResult)(Func(TResult), 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(Func(Task)) | 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(Func(Task), 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. |
InvokeAsync(TResult)(Func(TResult)) | Executes the specified Func<TResult> asynchronously on the thread that the Dispatcher was created on. |
InvokeAsync(TResult)(Func(Task(TResult))) | Executes the specified Func<Task<TResult>> asynchronously on the thread that the Dispatcher was created on |
InvokeAsync(TResult)(Func(TResult), DispatcherPriority) | Executes the specified Func<TResult> asynchronously on the thread that the Dispatcher was created on. |
InvokeAsync(TResult)(Func(Task(TResult)), DispatcherPriority) | Executes the specified Func<Task<TResult>> asynchronously on the thread that the Dispatcher was created on |
InvokeAsync(TResult)(Func(TResult), 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. |
MemberwiseClone() | Creates 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(Nullable(DispatcherPriority)) | Force-runs all dispatcher operations ignoring any pending OS events, use with caution |
ToString() | Returns 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. |