Dispatcher.InvokeAsync 方法

定义

在与 Dispatcher 关联的线程上异步执行指定的委托。

重载

InvokeAsync(Action)

在与 Action 关联的线程上异步执行指定的 Dispatcher

InvokeAsync(Action, DispatcherPriority)

在与 Action 关联的线程上,以指定的优先级,异步执行指定的 Dispatcher

InvokeAsync(Action, DispatcherPriority, CancellationToken)

在与 Action 关联的线程上,以指定的优先级,异步执行指定的 Dispatcher

InvokeAsync<TResult>(Func<TResult>, DispatcherPriority, CancellationToken)

在与 Func<TResult> 关联的线程上,以指定的优先级,异步执行指定的 Dispatcher

InvokeAsync<TResult>(Func<TResult>)

在与 Func<TResult> 关联的线程上异步执行指定的 Dispatcher

InvokeAsync<TResult>(Func<TResult>, DispatcherPriority)

在与 Func<TResult> 关联的线程上,以指定的优先级,异步执行指定的 Dispatcher

InvokeAsync(Action)

在与 Action 关联的线程上异步执行指定的 Dispatcher

public:
 System::Windows::Threading::DispatcherOperation ^ InvokeAsync(Action ^ callback);
public System.Windows.Threading.DispatcherOperation InvokeAsync (Action callback);
member this.InvokeAsync : Action -> System.Windows.Threading.DispatcherOperation
Public Function InvokeAsync (callback As Action) As DispatcherOperation

参数

callback
Action

要通过调度程序调用的委托。

返回

DispatcherOperation

调用 InvokeAsync(Action) 之后立即返回的对象,可用来与事件队列中挂起执行的委托进行交互。

注解

默认优先级为 DispatcherPriority.Normal.

适用于

InvokeAsync(Action, DispatcherPriority)

在与 Action 关联的线程上,以指定的优先级,异步执行指定的 Dispatcher

public:
 System::Windows::Threading::DispatcherOperation ^ InvokeAsync(Action ^ callback, System::Windows::Threading::DispatcherPriority priority);
public System.Windows.Threading.DispatcherOperation InvokeAsync (Action callback, System.Windows.Threading.DispatcherPriority priority);
member this.InvokeAsync : Action * System.Windows.Threading.DispatcherPriority -> System.Windows.Threading.DispatcherOperation
Public Function InvokeAsync (callback As Action, priority As DispatcherPriority) As DispatcherOperation

参数

callback
Action

要通过调度程序调用的委托。

priority
DispatcherPriority

确定指定回调相对于中其他挂起操作调用顺序的 Dispatcher优先级。

返回

DispatcherOperation

调用 InvokeAsync(Action, DispatcherPriority) 之后立即返回的对象,可用来与事件队列中挂起执行的委托进行交互。

适用于

InvokeAsync(Action, DispatcherPriority, CancellationToken)

在与 Action 关联的线程上,以指定的优先级,异步执行指定的 Dispatcher

public:
 System::Windows::Threading::DispatcherOperation ^ InvokeAsync(Action ^ callback, System::Windows::Threading::DispatcherPriority priority, System::Threading::CancellationToken cancellationToken);
public System.Windows.Threading.DispatcherOperation InvokeAsync (Action callback, System.Windows.Threading.DispatcherPriority priority, System.Threading.CancellationToken cancellationToken);
member this.InvokeAsync : Action * System.Windows.Threading.DispatcherPriority * System.Threading.CancellationToken -> System.Windows.Threading.DispatcherOperation
Public Function InvokeAsync (callback As Action, priority As DispatcherPriority, cancellationToken As CancellationToken) As DispatcherOperation

参数

callback
Action

要通过调度程序调用的委托。

priority
DispatcherPriority

确定指定回调相对于中其他挂起操作调用顺序的 Dispatcher优先级。

cancellationToken
CancellationToken

指示是否取消操作的对象。

返回

DispatcherOperation

调用 InvokeAsync(Action, DispatcherPriority, CancellationToken) 之后立即返回的对象,可用来与事件队列中挂起执行的委托进行交互。

适用于

InvokeAsync<TResult>(Func<TResult>, DispatcherPriority, CancellationToken)

在与 Func<TResult> 关联的线程上,以指定的优先级,异步执行指定的 Dispatcher

public:
generic <typename TResult>
 System::Windows::Threading::DispatcherOperation<TResult> ^ InvokeAsync(Func<TResult> ^ callback, System::Windows::Threading::DispatcherPriority priority, System::Threading::CancellationToken cancellationToken);
public System.Windows.Threading.DispatcherOperation<TResult> InvokeAsync<TResult> (Func<TResult> callback, System.Windows.Threading.DispatcherPriority priority, System.Threading.CancellationToken cancellationToken);
member this.InvokeAsync : Func<'Result> * System.Windows.Threading.DispatcherPriority * System.Threading.CancellationToken -> System.Windows.Threading.DispatcherOperation<'Result>
Public Function InvokeAsync(Of TResult) (callback As Func(Of TResult), priority As DispatcherPriority, cancellationToken As CancellationToken) As DispatcherOperation(Of TResult)

类型参数

TResult

指定委托的返回值类型。

参数

callback
Func<TResult>

要通过调度程序调用的委托。

priority
DispatcherPriority

确定指定回调相对于中其他挂起操作调用顺序的 Dispatcher优先级。

cancellationToken
CancellationToken

指示是否取消操作的对象。

返回

DispatcherOperation<TResult>

调用 InvokeAsync<TResult>(Func<TResult>, DispatcherPriority, CancellationToken) 之后立即返回的对象,可用来与事件队列中挂起执行的委托进行交互。

适用于

InvokeAsync<TResult>(Func<TResult>)

在与 Func<TResult> 关联的线程上异步执行指定的 Dispatcher

public:
generic <typename TResult>
 System::Windows::Threading::DispatcherOperation<TResult> ^ InvokeAsync(Func<TResult> ^ callback);
public System.Windows.Threading.DispatcherOperation<TResult> InvokeAsync<TResult> (Func<TResult> callback);
member this.InvokeAsync : Func<'Result> -> System.Windows.Threading.DispatcherOperation<'Result>
Public Function InvokeAsync(Of TResult) (callback As Func(Of TResult)) As DispatcherOperation(Of TResult)

类型参数

TResult

指定委托的返回值类型。

参数

callback
Func<TResult>

要通过调度程序调用的委托。

返回

DispatcherOperation<TResult>

调用 InvokeAsync<TResult>(Func<TResult>) 之后立即返回的对象,可用来与事件队列中挂起执行的委托进行交互。

适用于

InvokeAsync<TResult>(Func<TResult>, DispatcherPriority)

在与 Func<TResult> 关联的线程上,以指定的优先级,异步执行指定的 Dispatcher

public:
generic <typename TResult>
 System::Windows::Threading::DispatcherOperation<TResult> ^ InvokeAsync(Func<TResult> ^ callback, System::Windows::Threading::DispatcherPriority priority);
public System.Windows.Threading.DispatcherOperation<TResult> InvokeAsync<TResult> (Func<TResult> callback, System.Windows.Threading.DispatcherPriority priority);
member this.InvokeAsync : Func<'Result> * System.Windows.Threading.DispatcherPriority -> System.Windows.Threading.DispatcherOperation<'Result>
Public Function InvokeAsync(Of TResult) (callback As Func(Of TResult), priority As DispatcherPriority) As DispatcherOperation(Of TResult)

类型参数

TResult

指定委托的返回值类型。

参数

callback
Func<TResult>

要通过调度程序调用的委托。

priority
DispatcherPriority

确定指定回调相对于中其他挂起操作调用顺序的 Dispatcher优先级。

返回

DispatcherOperation<TResult>

调用 InvokeAsync<TResult>(Func<TResult>, DispatcherPriority) 之后立即返回的对象,可用来与事件队列中挂起执行的委托进行交互。

适用于