Operation With Progress<TResult,TProgress> Interface
Represents an asynchronous operation that can report progress updates to callers. This is the return type for many Windows Runtime asynchronous methods that have results and also report progress.
public interface class IAsyncOperationWithProgress : IAsyncInfo
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.FoundationContract, 65536)] /// [Windows.Foundation.Metadata.Guid(3050321623, 58007, 18831, 186, 96, 2, 137, 231, 110, 35, 221)] template <typename TResult, typename TProgress> struct IAsyncOperationWithProgress : IAsyncInfo
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.FoundationContract), 65536)] [Windows.Foundation.Metadata.Guid(3050321623, 58007, 18831, 186, 96, 2, 137, 231, 110, 35, 221)] public interface IAsyncOperationWithProgress<TResult,TProgress> : IAsyncInfo
Public Interface IAsyncOperationWithProgress(Of TResult, TProgress) Implements IAsyncInfo
Windows 10 requirements
Windows 10 (introduced in 10.0.10240.0)
Windows.Foundation.FoundationContract (introduced in v1.0)
IAsyncOperationWithProgress<TResult,TProgress> is the return type for many Windows Runtime asynchronous methods that have a result upon completion, and also support notifications that report progress (which callers can subscribe to by assigning a callback for Progress ). This constitutes about 100 different Windows Runtime APIs. APIs that don't report progress (but do have a result) use another interface, IAsyncOperation<TResult>.
Specifically, if you want to handle progress in .NET code, use the AsTask signature that in an extension usage has a single IProgress reference parameter. (In this usage, the progress unit is already constrained and matches the IAsyncOperationWithProgress method you're using.) Provide an object that implements IProgress, and your Report method implementation is invoked each time the Windows Runtime method reports a progress notification.
To monitor the progress of the action (if not using the language-specific techniques described above), set the Progress property, providing it the name of a method that implements the AsyncOperationProgressHandler<TResult,TProgress> delegate.
Notes to implementers
As with calling the existing methods, there are language-specific ways to define asynchronous methods that don't use IAsyncOperationWithProgress<TResult,TProgress> directly. If writing code using .NET, your method can return a Task<TResult>. For C++/CX, you can use the Concurrency runtime. However, if you're defining a component, you can use Task/task internally but you must return one of the Windows Runtime interfaces for your public methods. The language-specific asynchronous support types (and many other language-specific types you might conventionally use in code) can't be used for the public surface area of a Windows Runtime component.
Gets or sets the method that handles the operation completed notification.
Gets a string that describes an error condition of the asynchronous operation.(Inherited from IAsyncInfo)
Gets the handle of the asynchronous operation.(Inherited from IAsyncInfo)
Gets or sets the method that handles progress notifications.
Gets a value that indicates the status of the asynchronous operation.(Inherited from IAsyncInfo)
Cancels the asynchronous operation.(Inherited from IAsyncInfo)
Closes the asynchronous operation.(Inherited from IAsyncInfo)
Returns the results of the operation.