Share via


MainThread.InvokeOnMainThreadAsync Method

Definition

Overloads

InvokeOnMainThreadAsync(Action)

Invokes an action on the main thread of the application asynchronously.

InvokeOnMainThreadAsync(Func<Task>)

Invokes a function on the main thread of the application asynchronously.

InvokeOnMainThreadAsync<T>(Func<Task<T>>)

Invokes a function on the main thread of the application asynchronously.

InvokeOnMainThreadAsync<T>(Func<T>)

Invokes a function on the main thread of the application asynchronously.

InvokeOnMainThreadAsync(Action)

Source:
MainThread.shared.cs
Source:
MainThread.shared.cs

Invokes an action on the main thread of the application asynchronously.

public:
 static System::Threading::Tasks::Task ^ InvokeOnMainThreadAsync(Action ^ action);
public static System.Threading.Tasks.Task InvokeOnMainThreadAsync (Action action);
static member InvokeOnMainThreadAsync : Action -> System.Threading.Tasks.Task
Public Shared Function InvokeOnMainThreadAsync (action As Action) As Task

Parameters

action
Action

The action to invoke on the main thread.

Returns

A Task object with the current status of the asynchronous operation.

Applies to

InvokeOnMainThreadAsync(Func<Task>)

Source:
MainThread.shared.cs
Source:
MainThread.shared.cs

Invokes a function on the main thread of the application asynchronously.

public:
 static System::Threading::Tasks::Task ^ InvokeOnMainThreadAsync(Func<System::Threading::Tasks::Task ^> ^ funcTask);
public static System.Threading.Tasks.Task InvokeOnMainThreadAsync (Func<System.Threading.Tasks.Task> funcTask);
static member InvokeOnMainThreadAsync : Func<System.Threading.Tasks.Task> -> System.Threading.Tasks.Task
Public Shared Function InvokeOnMainThreadAsync (funcTask As Func(Of Task)) As Task

Parameters

funcTask
Func<Task>

The function task to execute on the main thread.

Returns

A Task object that can be awaited.

Applies to

InvokeOnMainThreadAsync<T>(Func<Task<T>>)

Source:
MainThread.shared.cs
Source:
MainThread.shared.cs

Invokes a function on the main thread of the application asynchronously.

public:
generic <typename T>
 static System::Threading::Tasks::Task<T> ^ InvokeOnMainThreadAsync(Func<System::Threading::Tasks::Task<T> ^> ^ funcTask);
public static System.Threading.Tasks.Task<T> InvokeOnMainThreadAsync<T> (Func<System.Threading.Tasks.Task<T>> funcTask);
static member InvokeOnMainThreadAsync : Func<System.Threading.Tasks.Task<'T>> -> System.Threading.Tasks.Task<'T>
Public Shared Function InvokeOnMainThreadAsync(Of T) (funcTask As Func(Of Task(Of T))) As Task(Of T)

Type Parameters

T

Type of the object to be returned.

Parameters

funcTask
Func<Task<T>>

The function task to execute on the main thread.

Returns

Task<T>

A Task object that can be awaited to capture the result object.

Applies to

InvokeOnMainThreadAsync<T>(Func<T>)

Source:
MainThread.shared.cs
Source:
MainThread.shared.cs

Invokes a function on the main thread of the application asynchronously.

public:
generic <typename T>
 static System::Threading::Tasks::Task<T> ^ InvokeOnMainThreadAsync(Func<T> ^ func);
public static System.Threading.Tasks.Task<T> InvokeOnMainThreadAsync<T> (Func<T> func);
static member InvokeOnMainThreadAsync : Func<'T> -> System.Threading.Tasks.Task<'T>
Public Shared Function InvokeOnMainThreadAsync(Of T) (func As Func(Of T)) As Task(Of T)

Type Parameters

T

Type of the object to be returned.

Parameters

func
Func<T>

The function task to execute on the main thread.

Returns

Task<T>

A Task object that can be awaited to capture the result object.

Applies to