Class IApplicationDispatcherExtensions
Extension methods for IApplicationDispatcher.
public static class IApplicationDispatcherExtensions
- Inheritance
-
IApplicationDispatcherExtensions
- Inherited Members
Methods
InvokeTaskAsync(IApplicationDispatcher, Func<Task>, DispatcherPriority)
Executes an asynchronous task asynchronously on the thread the application dispatcher is associated with.
public static Task InvokeTaskAsync(this IApplicationDispatcher applicationDispatcher, Func<Task> asyncCallback, DispatcherPriority priority = DispatcherPriority.Normal)
Parameters
applicationDispatcher
IApplicationDispatcherThe application dispatcher.
asyncCallback
Func<Task>A delegate to invoke through the dispatcher that represents an asynchronous task, returning a Task.
priority
DispatcherPriorityThe priority that determines in what order the specified callback is invoked relative to the other pending operations in the dispatcher. If not specified, this defaults to Normal.
Returns
- Task
A task that represents the asynchronous operation.
Remarks
This is preferred over InvokeAsync<TResult>(Func<TResult>) or InvokeAsync<TResult>(Func<TResult>, DispatcherPriority). See the remarks for those methods for more information.
Exceptions
- ArgumentNullException
applicationDispatcher
is null.- ArgumentNullException
asyncCallback
is null.
InvokeTaskAsync<TResult>(IApplicationDispatcher, Func<Task<TResult>>, DispatcherPriority)
Executes an asynchronous task asynchronously on the thread the application dispatcher is associated with.
public static Task<TResult> InvokeTaskAsync<TResult>(this IApplicationDispatcher applicationDispatcher, Func<Task<TResult>> asyncCallback, DispatcherPriority priority = DispatcherPriority.Normal)
Parameters
applicationDispatcher
IApplicationDispatcherThe application dispatcher.
asyncCallback
Func<Task<TResult>>A delegate to invoke through the dispatcher that represents an asynchronous task, returning a Task<TResult>.
priority
DispatcherPriorityThe priority that determines in what order the specified callback is invoked relative to the other pending operations in the dispatcher. If not specified, this defaults to Normal.
Returns
- Task<TResult>
A task that represents the asynchronous operation. The value of its Result property contains the result value of the
asyncCallback
task.
Type Parameters
TResult
Remarks
This is preferred over InvokeAsync<TResult>(Func<TResult>) or InvokeAsync<TResult>(Func<TResult>, DispatcherPriority). See the remarks for those methods for more information.
Exceptions
- ArgumentNullException
applicationDispatcher
is null.- ArgumentNullException
asyncCallback
is null.