Run(TResult, TProgress) Method (Func(CancellationToken, IProgress(TProgress), Task(TResult)))

AsyncInfo.Run(Of TResult, TProgress) Method (Func(Of CancellationToken, IProgress(Of TProgress), Task(Of TResult)))

For apps that target Windows Phone OS 7.0 and 7.1, do not use any members of this type in your app. If you do, your code will throw a MethodAccessException. This type is security-critical, which restricts it to internal use by the .NET Framework for Windows Phone class library.
[SECURITY CRITICAL]

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

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.

Namespace:  System.Runtime.InteropServices.WindowsRuntime
Assembly:  System.Runtime.WindowsRuntime (in System.Runtime.WindowsRuntime.dll)

'Declaration
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
Type: System.Func(Of CancellationToken, IProgress(Of TProgress), Task(Of 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.

Return Value

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

Windows Phone OS

Supported in: 8.1, 8.0

Show:
© 2017 Microsoft