Share via


MainThread Class

Definition

The MainThread class allows applications to run code on the main thread of execution, and to determine if a particular block of code is currently running on the main thread.

public ref class MainThread abstract sealed
public static class MainThread
type MainThread = class
Public Class MainThread
Inheritance
MainThread

Remarks

Main Thread helpers.

Properties

IsMainThread

True if the current thread is the UI thread.

Methods

BeginInvokeOnMainThread(Action)

Invokes an action on the main thread of the application.

GetMainThreadSynchronizationContextAsync()

Gets the main thread synchonization context.

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<T>)

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.

Applies to