DispatcherExtensions.DispatchAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
DispatchAsync(IDispatcher, Action) |
Schedules the provided action on the UI thread from a worker thread. |
DispatchAsync(IDispatcher, Func<Task>) |
Schedules the provided function on the UI thread from a worker thread. |
DispatchAsync<T>(IDispatcher, Func<Task<T>>) |
Schedules the provided function on the UI thread from a worker thread. |
DispatchAsync<T>(IDispatcher, Func<T>) |
Schedules the provided callback on the UI thread from a worker thread, and returns the results asynchronously. |
DispatchAsync(IDispatcher, Action)
- Source:
- DispatcherExtensions.cs
- Source:
- DispatcherExtensions.cs
Schedules the provided action on the UI thread from a worker thread.
public:
[System::Runtime::CompilerServices::Extension]
static System::Threading::Tasks::Task ^ DispatchAsync(Microsoft::Maui::Dispatching::IDispatcher ^ dispatcher, Action ^ action);
public static System.Threading.Tasks.Task DispatchAsync (this Microsoft.Maui.Dispatching.IDispatcher dispatcher, Action action);
static member DispatchAsync : Microsoft.Maui.Dispatching.IDispatcher * Action -> System.Threading.Tasks.Task
<Extension()>
Public Function DispatchAsync (dispatcher As IDispatcher, action As Action) As Task
Parameters
- dispatcher
- IDispatcher
The IDispatcher instance this method is called on.
- action
- Action
The method to be executed by the dispatcher.
Returns
Task.
Applies to
DispatchAsync(IDispatcher, Func<Task>)
- Source:
- DispatcherExtensions.cs
- Source:
- DispatcherExtensions.cs
Schedules the provided function on the UI thread from a worker thread.
public:
[System::Runtime::CompilerServices::Extension]
static System::Threading::Tasks::Task ^ DispatchAsync(Microsoft::Maui::Dispatching::IDispatcher ^ dispatcher, Func<System::Threading::Tasks::Task ^> ^ funcTask);
public static System.Threading.Tasks.Task DispatchAsync (this Microsoft.Maui.Dispatching.IDispatcher dispatcher, Func<System.Threading.Tasks.Task> funcTask);
static member DispatchAsync : Microsoft.Maui.Dispatching.IDispatcher * Func<System.Threading.Tasks.Task> -> System.Threading.Tasks.Task
<Extension()>
Public Function DispatchAsync (dispatcher As IDispatcher, funcTask As Func(Of Task)) As Task
Parameters
- dispatcher
- IDispatcher
The IDispatcher instance this method is called on.
Returns
Task
.
Applies to
DispatchAsync<T>(IDispatcher, Func<Task<T>>)
- Source:
- DispatcherExtensions.cs
- Source:
- DispatcherExtensions.cs
Schedules the provided function on the UI thread from a worker thread.
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
static System::Threading::Tasks::Task<T> ^ DispatchAsync(Microsoft::Maui::Dispatching::IDispatcher ^ dispatcher, Func<System::Threading::Tasks::Task<T> ^> ^ funcTask);
public static System.Threading.Tasks.Task<T> DispatchAsync<T> (this Microsoft.Maui.Dispatching.IDispatcher dispatcher, Func<System.Threading.Tasks.Task<T>> funcTask);
static member DispatchAsync : Microsoft.Maui.Dispatching.IDispatcher * Func<System.Threading.Tasks.Task<'T>> -> System.Threading.Tasks.Task<'T>
<Extension()>
Public Function DispatchAsync(Of T) (dispatcher As IDispatcher, funcTask As Func(Of Task(Of T))) As Task(Of T)
Type Parameters
- T
The type returned from this method.
Parameters
- dispatcher
- IDispatcher
The IDispatcher instance this method is called on.
Returns
A Task<TResult> object containing information about the state of the dispatcher operation.
Applies to
DispatchAsync<T>(IDispatcher, Func<T>)
- Source:
- DispatcherExtensions.cs
- Source:
- DispatcherExtensions.cs
Schedules the provided callback on the UI thread from a worker thread, and returns the results asynchronously.
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
static System::Threading::Tasks::Task<T> ^ DispatchAsync(Microsoft::Maui::Dispatching::IDispatcher ^ dispatcher, Func<T> ^ func);
public static System.Threading.Tasks.Task<T> DispatchAsync<T> (this Microsoft.Maui.Dispatching.IDispatcher dispatcher, Func<T> func);
static member DispatchAsync : Microsoft.Maui.Dispatching.IDispatcher * Func<'T> -> System.Threading.Tasks.Task<'T>
<Extension()>
Public Function DispatchAsync(Of T) (dispatcher As IDispatcher, func As Func(Of T)) As Task(Of T)
Type Parameters
- T
The type returned from this method.
Parameters
- dispatcher
- IDispatcher
The IDispatcher instance this method is called on.
- func
- Func<T>
The method to be executed by the dispatcher.
Returns
A Task<TResult> object containing information about the state of the dispatcher operation.