AsyncInfo.Run Method

Definition

Overloads

Run(Func<CancellationToken,Task>)

Creates and starts a Windows Runtime asynchronous action by using a function that generates a started task. The task can support cancellation.

Run<TProgress>(Func<CancellationToken,IProgress<TProgress>,Task>)

Creates and starts a Windows Runtime asynchronous action that includes progress updates, by using a function that generates a started task. The task can support cancellation and progress reporting.

Run<TResult,TProgress>(Func<CancellationToken,IProgress<TProgress>,Task<TResult>>)

Creates and starts a Windows Runtime asynchronous operation that includes progress updates, by using a function that generates a started task that returns results. The task can support cancellation and progress reporting.

Run<TResult>(Func<CancellationToken,Task<TResult>>)

Creates and starts a Windows Runtime asynchronous operation by using a function that generates a started task that returns results. The task can support cancellation.

Run(Func<CancellationToken,Task>)

Creates and starts a Windows Runtime asynchronous action by using a function that generates a started task. The task can support cancellation.

public:
 static Windows::Foundation::IAsyncAction ^ Run(Func<System::Threading::CancellationToken, System::Threading::Tasks::Task ^> ^ taskProvider);
public static Windows.Foundation.IAsyncAction Run (Func<System.Threading.CancellationToken,System.Threading.Tasks.Task> taskProvider);
static member Run : Func<System.Threading.CancellationToken, System.Threading.Tasks.Task> -> Windows.Foundation.IAsyncAction
Public Shared Function Run (taskProvider As Func(Of CancellationToken, Task)) As IAsyncAction

Parameters

taskProvider
Func<CancellationToken,Task>

A delegate that represents the function that creates and starts the task. The started task is represented by the Windows Runtime asynchronous action that is returned. The function is passed a cancellation token that the task can monitor to be notified of cancellation requests; you can ignore the token if your task does not support cancellation.

Returns

A started Windows.Foundation.IAsyncAction instance that represents the task that is generated by taskProvider.

Exceptions

taskProvider is null.

taskProvider returns an unstarted task.

Applies to

Run<TProgress>(Func<CancellationToken,IProgress<TProgress>,Task>)

Creates and starts a Windows Runtime asynchronous action that includes progress updates, by using a function that generates a started task. The task can support cancellation and progress reporting.

public:
generic <typename TProgress>
 static Windows::Foundation::IAsyncActionWithProgress<TProgress> ^ Run(Func<System::Threading::CancellationToken, IProgress<TProgress> ^, System::Threading::Tasks::Task ^> ^ taskProvider);
public static Windows.Foundation.IAsyncActionWithProgress<TProgress> Run<TProgress> (Func<System.Threading.CancellationToken,IProgress<TProgress>,System.Threading.Tasks.Task> taskProvider);
static member Run : Func<System.Threading.CancellationToken, IProgress<'Progress>, System.Threading.Tasks.Task> -> Windows.Foundation.IAsyncActionWithProgress<'Progress>
Public Shared Function Run(Of TProgress) (taskProvider As Func(Of CancellationToken, IProgress(Of TProgress), Task)) As IAsyncActionWithProgress(Of TProgress)

Type Parameters

TProgress

The type that is used for progress notifications.

Parameters

taskProvider
Func<CancellationToken,IProgress<TProgress>,Task>

A delegate that represents the function that creates and starts the task. The started task is represented by the Windows Runtime asynchronous action that is returned. The function is passed a cancellation token that the task can monitor to be notified of cancellation requests, and an interface for reporting progress; you can ignore either or both of these arguments if your task does not support progress reporting or cancellation.

Returns

A started Windows.Foundation.IAsyncActionWithProgress<TProgress> instance that represents the task that is generated by taskProvider.

Exceptions

taskProvider is null.

taskProvider returns an unstarted task.

Applies to

Run<TResult,TProgress>(Func<CancellationToken,IProgress<TProgress>,Task<TResult>>)

Creates and starts a Windows Runtime asynchronous operation that includes progress updates, by using a function that generates a started task that returns results. The task can support cancellation and progress reporting.

public:
generic <typename TResult, typename TProgress>
 static Windows::Foundation::IAsyncOperationWithProgress<TResult, TProgress> ^ Run(Func<System::Threading::CancellationToken, IProgress<TProgress> ^, System::Threading::Tasks::Task<TResult> ^> ^ taskProvider);
public static Windows.Foundation.IAsyncOperationWithProgress<TResult,TProgress> Run<TResult,TProgress> (Func<System.Threading.CancellationToken,IProgress<TProgress>,System.Threading.Tasks.Task<TResult>> taskProvider);
static member Run : Func<System.Threading.CancellationToken, IProgress<'Progress>, System.Threading.Tasks.Task<'Result>> -> Windows.Foundation.IAsyncOperationWithProgress<'Result, 'Progress>
Public Shared Function Run(Of TResult, TProgress) (taskProvider As Func(Of CancellationToken, IProgress(Of TProgress), Task(Of TResult))) As IAsyncOperationWithProgress(Of TResult, TProgress)

Type Parameters

TResult

The type that returns the result.

TProgress

The type that is used for progress notifications.

Parameters

taskProvider
Func<CancellationToken,IProgress<TProgress>,Task<TResult>>

A delegate that represents the function that creates and starts the task. The started task is represented by the Windows Runtime asynchronous action that is returned. The function is passed a cancellation token that the task can monitor to be notified of cancellation requests, and an interface for reporting progress; you can ignore either or both of these arguments if your task does not support progress reporting or cancellation.

Returns

IAsyncOperationWithProgress<TResult,TProgress>

A started Windows.Foundation.IAsyncOperationWithProgress<TResult,TProgress> instance that represents the task that is generated by taskProvider.

Exceptions

taskProvider is null.

taskProvider returns an unstarted task.

Applies to

Run<TResult>(Func<CancellationToken,Task<TResult>>)

Creates and starts a Windows Runtime asynchronous operation by using a function that generates a started task that returns results. The task can support cancellation.

public:
generic <typename TResult>
 static Windows::Foundation::IAsyncOperation<TResult> ^ Run(Func<System::Threading::CancellationToken, System::Threading::Tasks::Task<TResult> ^> ^ taskProvider);
public static Windows.Foundation.IAsyncOperation<TResult> Run<TResult> (Func<System.Threading.CancellationToken,System.Threading.Tasks.Task<TResult>> taskProvider);
static member Run : Func<System.Threading.CancellationToken, System.Threading.Tasks.Task<'Result>> -> Windows.Foundation.IAsyncOperation<'Result>
Public Shared Function Run(Of TResult) (taskProvider As Func(Of CancellationToken, Task(Of TResult))) As IAsyncOperation(Of TResult)

Type Parameters

TResult

The type that returns the result.

Parameters

taskProvider
Func<CancellationToken,Task<TResult>>

A delegate that represents the function that creates and starts the task. The started task is represented by the Windows Runtime asynchronous operation that is returned. The function is passed a cancellation token that the task can monitor to be notified of cancellation requests; you can ignore the token if your task does not support cancellation.

Returns

IAsyncOperation<TResult>

A started Windows.Foundation.IAsyncOperation<TResult> instance that represents the task that is generated by taskProvider.

Exceptions

taskProvider is null.

taskProvider returns an unstarted task.

Applies to