共用方式為


DispatcherExtensions.DispatchAsync 方法

定義

多載

DispatchAsync(IDispatcher, Action)

從背景工作線程排程UI線程上提供的動作。

DispatchAsync(IDispatcher, Func<Task>)

從背景工作線程排程UI線程上提供的函式。

DispatchAsync<T>(IDispatcher, Func<Task<T>>)

從背景工作線程排程UI線程上提供的函式。

DispatchAsync<T>(IDispatcher, Func<T>)

從背景工作線程排程UI線程上提供的回呼,並以異步方式傳回結果。

DispatchAsync(IDispatcher, Action)

來源:
DispatcherExtensions.cs
來源:
DispatcherExtensions.cs

從背景工作線程排程UI線程上提供的動作。

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

參數

dispatcher
IDispatcher

呼叫 IDispatcher 這個方法的實例。

action
Action

發送器要執行的方法。

傳回

Task.

適用於

DispatchAsync(IDispatcher, Func<Task>)

來源:
DispatcherExtensions.cs
來源:
DispatcherExtensions.cs

從背景工作線程排程UI線程上提供的函式。

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

參數

dispatcher
IDispatcher

呼叫 IDispatcher 這個方法的實例。

funcTask
Func<Task>

發送器要執行的函式。

傳回

Task.

適用於

DispatchAsync<T>(IDispatcher, Func<Task<T>>)

來源:
DispatcherExtensions.cs
來源:
DispatcherExtensions.cs

從背景工作線程排程UI線程上提供的函式。

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)

類型參數

T

從這個方法傳回的類型。

參數

dispatcher
IDispatcher

呼叫 IDispatcher 這個方法的實例。

funcTask
Func<Task<T>>

發送器要執行的函式。

傳回

Task<T>

Task<TResult>物件,包含發送器作業狀態的相關信息。

適用於

DispatchAsync<T>(IDispatcher, Func<T>)

來源:
DispatcherExtensions.cs
來源:
DispatcherExtensions.cs

從背景工作線程排程UI線程上提供的回呼,並以異步方式傳回結果。

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)

類型參數

T

從這個方法傳回的類型。

參數

dispatcher
IDispatcher

呼叫 IDispatcher 這個方法的實例。

func
Func<T>

發送器要執行的方法。

傳回

Task<T>

Task<TResult>物件,包含發送器作業狀態的相關信息。

適用於