DispatcherExtensions.DispatchAsync 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
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)
從背景工作線程排程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>)
從背景工作線程排程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 這個方法的實例。
傳回
Task
.
適用於
DispatchAsync<T>(IDispatcher, Func<Task<T>>)
從背景工作線程排程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 這個方法的實例。
傳回
Task<T>
Task<TResult>物件,包含發送器作業狀態的相關信息。
適用於
DispatchAsync<T>(IDispatcher, Func<T>)
從背景工作線程排程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>物件,包含發送器作業狀態的相關信息。