Edit

Share via


DispatcherHelper.ExecuteOnUIThreadAsync Method

Definition

Overloads

ExecuteOnUIThreadAsync(Action, CoreDispatcherPriority)
Obsolete.

Executes the given function on the main view's UI thread.

ExecuteOnUIThreadAsync(Func<Task>, CoreDispatcherPriority)
Obsolete.

Executes the given Task-returning function on the main view's UI thread and returns either that Task or a proxy Task that completes when the one produced by the given function completes.

ExecuteOnUIThreadAsync(CoreApplicationView, Action, CoreDispatcherPriority)
Obsolete.

Executes the given function on a given view's UI thread.

ExecuteOnUIThreadAsync(CoreApplicationView, Func<Task>, CoreDispatcherPriority)
Obsolete.

Executes the given function on a given view's UI thread.

ExecuteOnUIThreadAsync<T>(Func<Task<T>>, CoreDispatcherPriority)
Obsolete.

Executes the given Task<TResult>-returning function on the main view's UI thread and returns either that Task<TResult> or a proxy Task<TResult> that completes when the one produced by the given function completes.

ExecuteOnUIThreadAsync<T>(Func<T>, CoreDispatcherPriority)
Obsolete.

Executes the given function on the main view's UI thread and returns its result.

ExecuteOnUIThreadAsync<T>(CoreApplicationView, Func<Task<T>>, CoreDispatcherPriority)
Obsolete.

Executes the given function on a given view's UI thread.

ExecuteOnUIThreadAsync<T>(CoreApplicationView, Func<T>, CoreDispatcherPriority)
Obsolete.

Executes the given function on a given view's UI thread.

ExecuteOnUIThreadAsync(Action, CoreDispatcherPriority)

Caution

This method should be replaced with dispatcherQueue.EnqueueAsync(function, priority), where dispatcherQueue is a DispatcherQueue instance that was retrieved from the UI thread and stored for later use.

Executes the given function on the main view's UI thread.

public static System.Threading.Tasks.Task ExecuteOnUIThreadAsync (Action function, Windows.UI.Core.CoreDispatcherPriority priority = Windows.UI.Core.CoreDispatcherPriority.Normal);
[System.Obsolete("This method should be replaced with dispatcherQueue.EnqueueAsync(function, priority), where dispatcherQueue is a DispatcherQueue instance that was retrieved from the UI thread and stored for later use.")]
public static System.Threading.Tasks.Task ExecuteOnUIThreadAsync (Action function, Windows.UI.Core.CoreDispatcherPriority priority = Windows.UI.Core.CoreDispatcherPriority.Normal);
static member ExecuteOnUIThreadAsync : Action * Windows.UI.Core.CoreDispatcherPriority -> System.Threading.Tasks.Task
[<System.Obsolete("This method should be replaced with dispatcherQueue.EnqueueAsync(function, priority), where dispatcherQueue is a DispatcherQueue instance that was retrieved from the UI thread and stored for later use.")>]
static member ExecuteOnUIThreadAsync : Action * Windows.UI.Core.CoreDispatcherPriority -> System.Threading.Tasks.Task
Public Function ExecuteOnUIThreadAsync (function As Action, Optional priority As CoreDispatcherPriority = Windows.UI.Core.CoreDispatcherPriority.Normal) As Task

Parameters

function
Action

Synchronous function to be executed on UI thread.

priority
Windows.UI.Core.CoreDispatcherPriority

Dispatcher execution priority, default is normal.

Returns

An awaitable Task for the operation.

Attributes

Remarks

If the current thread has UI access, function will be invoked directly.

Applies to

ExecuteOnUIThreadAsync(Func<Task>, CoreDispatcherPriority)

Caution

This method should be replaced with dispatcherQueue.EnqueueAsync(function, priority), where dispatcherQueue is a DispatcherQueue instance that was retrieved from the UI thread and stored for later use.

Executes the given Task-returning function on the main view's UI thread and returns either that Task or a proxy Task that completes when the one produced by the given function completes.

public static System.Threading.Tasks.Task ExecuteOnUIThreadAsync (Func<System.Threading.Tasks.Task> function, Windows.UI.Core.CoreDispatcherPriority priority = Windows.UI.Core.CoreDispatcherPriority.Normal);
[System.Obsolete("This method should be replaced with dispatcherQueue.EnqueueAsync(function, priority), where dispatcherQueue is a DispatcherQueue instance that was retrieved from the UI thread and stored for later use.")]
public static System.Threading.Tasks.Task ExecuteOnUIThreadAsync (Func<System.Threading.Tasks.Task> function, Windows.UI.Core.CoreDispatcherPriority priority = Windows.UI.Core.CoreDispatcherPriority.Normal);
static member ExecuteOnUIThreadAsync : Func<System.Threading.Tasks.Task> * Windows.UI.Core.CoreDispatcherPriority -> System.Threading.Tasks.Task
[<System.Obsolete("This method should be replaced with dispatcherQueue.EnqueueAsync(function, priority), where dispatcherQueue is a DispatcherQueue instance that was retrieved from the UI thread and stored for later use.")>]
static member ExecuteOnUIThreadAsync : Func<System.Threading.Tasks.Task> * Windows.UI.Core.CoreDispatcherPriority -> System.Threading.Tasks.Task
Public Function ExecuteOnUIThreadAsync (function As Func(Of Task), Optional priority As CoreDispatcherPriority = Windows.UI.Core.CoreDispatcherPriority.Normal) As Task

Parameters

function
Func<Task>

Asynchronous function to be executed asynchronously on UI thread.

priority
Windows.UI.Core.CoreDispatcherPriority

Dispatcher execution priority, default is normal.

Returns

An awaitable Task for the operation.

Attributes

Applies to

ExecuteOnUIThreadAsync(CoreApplicationView, Action, CoreDispatcherPriority)

Caution

This method should be replaced with viewToExecuteOn.DispatcherQueue.EnqueueAsync(function, priority).

Executes the given function on a given view's UI thread.

public static System.Threading.Tasks.Task ExecuteOnUIThreadAsync (this Windows.ApplicationModel.Core.CoreApplicationView viewToExecuteOn, Action function, Windows.UI.Core.CoreDispatcherPriority priority = Windows.UI.Core.CoreDispatcherPriority.Normal);
[System.Obsolete("This method should be replaced with viewToExecuteOn.DispatcherQueue.EnqueueAsync(function, priority).")]
public static System.Threading.Tasks.Task ExecuteOnUIThreadAsync (this Windows.ApplicationModel.Core.CoreApplicationView viewToExecuteOn, Action function, Windows.UI.Core.CoreDispatcherPriority priority = Windows.UI.Core.CoreDispatcherPriority.Normal);
static member ExecuteOnUIThreadAsync : Windows.ApplicationModel.Core.CoreApplicationView * Action * Windows.UI.Core.CoreDispatcherPriority -> System.Threading.Tasks.Task
[<System.Obsolete("This method should be replaced with viewToExecuteOn.DispatcherQueue.EnqueueAsync(function, priority).")>]
static member ExecuteOnUIThreadAsync : Windows.ApplicationModel.Core.CoreApplicationView * Action * Windows.UI.Core.CoreDispatcherPriority -> System.Threading.Tasks.Task
<Extension()>
Public Function ExecuteOnUIThreadAsync (viewToExecuteOn As CoreApplicationView, function As Action, Optional priority As CoreDispatcherPriority = Windows.UI.Core.CoreDispatcherPriority.Normal) As Task

Parameters

viewToExecuteOn
Windows.ApplicationModel.Core.CoreApplicationView

View for the function to be executed on.

function
Action

Synchronous function to be executed on UI thread.

priority
Windows.UI.Core.CoreDispatcherPriority

Dispatcher execution priority, default is normal

Returns

An awaitable Task for the operation.

Attributes

Remarks

If the current thread has UI access, function will be invoked directly.

Applies to

ExecuteOnUIThreadAsync(CoreApplicationView, Func<Task>, CoreDispatcherPriority)

Caution

This method should be replaced with viewToExecuteOn.DispatcherQueue.EnqueueAsync(function, priority).

Executes the given function on a given view's UI thread.

public static System.Threading.Tasks.Task ExecuteOnUIThreadAsync (this Windows.ApplicationModel.Core.CoreApplicationView viewToExecuteOn, Func<System.Threading.Tasks.Task> function, Windows.UI.Core.CoreDispatcherPriority priority = Windows.UI.Core.CoreDispatcherPriority.Normal);
[System.Obsolete("This method should be replaced with viewToExecuteOn.DispatcherQueue.EnqueueAsync(function, priority).")]
public static System.Threading.Tasks.Task ExecuteOnUIThreadAsync (this Windows.ApplicationModel.Core.CoreApplicationView viewToExecuteOn, Func<System.Threading.Tasks.Task> function, Windows.UI.Core.CoreDispatcherPriority priority = Windows.UI.Core.CoreDispatcherPriority.Normal);
static member ExecuteOnUIThreadAsync : Windows.ApplicationModel.Core.CoreApplicationView * Func<System.Threading.Tasks.Task> * Windows.UI.Core.CoreDispatcherPriority -> System.Threading.Tasks.Task
[<System.Obsolete("This method should be replaced with viewToExecuteOn.DispatcherQueue.EnqueueAsync(function, priority).")>]
static member ExecuteOnUIThreadAsync : Windows.ApplicationModel.Core.CoreApplicationView * Func<System.Threading.Tasks.Task> * Windows.UI.Core.CoreDispatcherPriority -> System.Threading.Tasks.Task
<Extension()>
Public Function ExecuteOnUIThreadAsync (viewToExecuteOn As CoreApplicationView, function As Func(Of Task), Optional priority As CoreDispatcherPriority = Windows.UI.Core.CoreDispatcherPriority.Normal) As Task

Parameters

viewToExecuteOn
Windows.ApplicationModel.Core.CoreApplicationView

View for the function to be executed on.

function
Func<Task>

Asynchronous function to be executed asynchronously on UI thread.

priority
Windows.UI.Core.CoreDispatcherPriority

Dispatcher execution priority, default is normal.

Returns

An awaitable Task for the operation.

Attributes

Remarks

If the current thread has UI access, function will be invoked directly.

Applies to

ExecuteOnUIThreadAsync<T>(Func<Task<T>>, CoreDispatcherPriority)

Caution

This method should be replaced with dispatcherQueue.EnqueueAsync(function, priority), where dispatcherQueue is a DispatcherQueue instance that was retrieved from the UI thread and stored for later use.

Executes the given Task<TResult>-returning function on the main view's UI thread and returns either that Task<TResult> or a proxy Task<TResult> that completes when the one produced by the given function completes.

public static System.Threading.Tasks.Task<T> ExecuteOnUIThreadAsync<T> (Func<System.Threading.Tasks.Task<T>> function, Windows.UI.Core.CoreDispatcherPriority priority = Windows.UI.Core.CoreDispatcherPriority.Normal);
[System.Obsolete("This method should be replaced with dispatcherQueue.EnqueueAsync(function, priority), where dispatcherQueue is a DispatcherQueue instance that was retrieved from the UI thread and stored for later use.")]
public static System.Threading.Tasks.Task<T> ExecuteOnUIThreadAsync<T> (Func<System.Threading.Tasks.Task<T>> function, Windows.UI.Core.CoreDispatcherPriority priority = Windows.UI.Core.CoreDispatcherPriority.Normal);
static member ExecuteOnUIThreadAsync : Func<System.Threading.Tasks.Task<'T>> * Windows.UI.Core.CoreDispatcherPriority -> System.Threading.Tasks.Task<'T>
[<System.Obsolete("This method should be replaced with dispatcherQueue.EnqueueAsync(function, priority), where dispatcherQueue is a DispatcherQueue instance that was retrieved from the UI thread and stored for later use.")>]
static member ExecuteOnUIThreadAsync : Func<System.Threading.Tasks.Task<'T>> * Windows.UI.Core.CoreDispatcherPriority -> System.Threading.Tasks.Task<'T>
Public Function ExecuteOnUIThreadAsync(Of T) (function As Func(Of Task(Of T)), Optional priority As CoreDispatcherPriority = Windows.UI.Core.CoreDispatcherPriority.Normal) As Task(Of T)

Type Parameters

T

Returned data type of the function.

Parameters

function
Func<Task<T>>

Asynchronous function to be executed asynchronously on UI thread.

priority
Windows.UI.Core.CoreDispatcherPriority

Dispatcher execution priority, default is normal.

Returns

Task<T>

An awaitable Task<TResult> for the operation.

Attributes

Applies to

ExecuteOnUIThreadAsync<T>(Func<T>, CoreDispatcherPriority)

Caution

This method should be replaced with dispatcherQueue.EnqueueAsync(function, priority), where dispatcherQueue is a DispatcherQueue instance that was retrieved from the UI thread and stored for later use.

Executes the given function on the main view's UI thread and returns its result.

public static System.Threading.Tasks.Task<T> ExecuteOnUIThreadAsync<T> (Func<T> function, Windows.UI.Core.CoreDispatcherPriority priority = Windows.UI.Core.CoreDispatcherPriority.Normal);
[System.Obsolete("This method should be replaced with dispatcherQueue.EnqueueAsync(function, priority), where dispatcherQueue is a DispatcherQueue instance that was retrieved from the UI thread and stored for later use.")]
public static System.Threading.Tasks.Task<T> ExecuteOnUIThreadAsync<T> (Func<T> function, Windows.UI.Core.CoreDispatcherPriority priority = Windows.UI.Core.CoreDispatcherPriority.Normal);
static member ExecuteOnUIThreadAsync : Func<'T> * Windows.UI.Core.CoreDispatcherPriority -> System.Threading.Tasks.Task<'T>
[<System.Obsolete("This method should be replaced with dispatcherQueue.EnqueueAsync(function, priority), where dispatcherQueue is a DispatcherQueue instance that was retrieved from the UI thread and stored for later use.")>]
static member ExecuteOnUIThreadAsync : Func<'T> * Windows.UI.Core.CoreDispatcherPriority -> System.Threading.Tasks.Task<'T>
Public Function ExecuteOnUIThreadAsync(Of T) (function As Func(Of T), Optional priority As CoreDispatcherPriority = Windows.UI.Core.CoreDispatcherPriority.Normal) As Task(Of T)

Type Parameters

T

Returned data type of the function.

Parameters

function
Func<T>

Synchronous function to be executed on UI thread.

priority
Windows.UI.Core.CoreDispatcherPriority

Dispatcher execution priority, default is normal.

Returns

Task<T>

An awaitable Task<TResult> for the operation.

Attributes

Remarks

If the current thread has UI access, function will be invoked directly.

Applies to

ExecuteOnUIThreadAsync<T>(CoreApplicationView, Func<Task<T>>, CoreDispatcherPriority)

Caution

This method should be replaced with viewToExecuteOn.DispatcherQueue.EnqueueAsync(function, priority).

Executes the given function on a given view's UI thread.

public static System.Threading.Tasks.Task<T> ExecuteOnUIThreadAsync<T> (this Windows.ApplicationModel.Core.CoreApplicationView viewToExecuteOn, Func<System.Threading.Tasks.Task<T>> function, Windows.UI.Core.CoreDispatcherPriority priority = Windows.UI.Core.CoreDispatcherPriority.Normal);
[System.Obsolete("This method should be replaced with viewToExecuteOn.DispatcherQueue.EnqueueAsync(function, priority).")]
public static System.Threading.Tasks.Task<T> ExecuteOnUIThreadAsync<T> (this Windows.ApplicationModel.Core.CoreApplicationView viewToExecuteOn, Func<System.Threading.Tasks.Task<T>> function, Windows.UI.Core.CoreDispatcherPriority priority = Windows.UI.Core.CoreDispatcherPriority.Normal);
static member ExecuteOnUIThreadAsync : Windows.ApplicationModel.Core.CoreApplicationView * Func<System.Threading.Tasks.Task<'T>> * Windows.UI.Core.CoreDispatcherPriority -> System.Threading.Tasks.Task<'T>
[<System.Obsolete("This method should be replaced with viewToExecuteOn.DispatcherQueue.EnqueueAsync(function, priority).")>]
static member ExecuteOnUIThreadAsync : Windows.ApplicationModel.Core.CoreApplicationView * Func<System.Threading.Tasks.Task<'T>> * Windows.UI.Core.CoreDispatcherPriority -> System.Threading.Tasks.Task<'T>
<Extension()>
Public Function ExecuteOnUIThreadAsync(Of T) (viewToExecuteOn As CoreApplicationView, function As Func(Of Task(Of T)), Optional priority As CoreDispatcherPriority = Windows.UI.Core.CoreDispatcherPriority.Normal) As Task(Of T)

Type Parameters

T

Returned data type of the function.

Parameters

viewToExecuteOn
Windows.ApplicationModel.Core.CoreApplicationView

View for the function to be executed on.

function
Func<Task<T>>

Asynchronous function to be executed asynchronously on UI thread.

priority
Windows.UI.Core.CoreDispatcherPriority

Dispatcher execution priority, default is normal.

Returns

Task<T>

An awaitable Task for the operation.

Attributes

Remarks

If the current thread has UI access, function will be invoked directly.

Applies to

ExecuteOnUIThreadAsync<T>(CoreApplicationView, Func<T>, CoreDispatcherPriority)

Caution

This method should be replaced with viewToExecuteOn.DispatcherQueue.EnqueueAsync(function, priority).

Executes the given function on a given view's UI thread.

public static System.Threading.Tasks.Task<T> ExecuteOnUIThreadAsync<T> (this Windows.ApplicationModel.Core.CoreApplicationView viewToExecuteOn, Func<T> function, Windows.UI.Core.CoreDispatcherPriority priority = Windows.UI.Core.CoreDispatcherPriority.Normal);
[System.Obsolete("This method should be replaced with viewToExecuteOn.DispatcherQueue.EnqueueAsync(function, priority).")]
public static System.Threading.Tasks.Task<T> ExecuteOnUIThreadAsync<T> (this Windows.ApplicationModel.Core.CoreApplicationView viewToExecuteOn, Func<T> function, Windows.UI.Core.CoreDispatcherPriority priority = Windows.UI.Core.CoreDispatcherPriority.Normal);
static member ExecuteOnUIThreadAsync : Windows.ApplicationModel.Core.CoreApplicationView * Func<'T> * Windows.UI.Core.CoreDispatcherPriority -> System.Threading.Tasks.Task<'T>
[<System.Obsolete("This method should be replaced with viewToExecuteOn.DispatcherQueue.EnqueueAsync(function, priority).")>]
static member ExecuteOnUIThreadAsync : Windows.ApplicationModel.Core.CoreApplicationView * Func<'T> * Windows.UI.Core.CoreDispatcherPriority -> System.Threading.Tasks.Task<'T>
<Extension()>
Public Function ExecuteOnUIThreadAsync(Of T) (viewToExecuteOn As CoreApplicationView, function As Func(Of T), Optional priority As CoreDispatcherPriority = Windows.UI.Core.CoreDispatcherPriority.Normal) As Task(Of T)

Type Parameters

T

Returned data type of the function.

Parameters

viewToExecuteOn
Windows.ApplicationModel.Core.CoreApplicationView

View for the function to be executed on.

function
Func<T>

Synchronous function with return type T to be executed on UI thread.

priority
Windows.UI.Core.CoreDispatcherPriority

Dispatcher execution priority, default is normal.

Returns

Task<T>

An awaitable Task<TResult> for the operation.

Attributes

Remarks

If the current thread has UI access, function will be invoked directly.

Applies to