BackgroundTaskProgressEventArgs Class

Definition

Represents progress information for a task at the time a progress update notification is sent.

public ref class BackgroundTaskProgressEventArgs sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class BackgroundTaskProgressEventArgs sealed
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class BackgroundTaskProgressEventArgs
Public NotInheritable Class BackgroundTaskProgressEventArgs
Inheritance
BackgroundTaskProgressEventArgs
Attributes

Windows 10 requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Examples

The following example shows how to use the BackgroundTaskProgressEventArgs class with a BackgroundTaskProgressEventHandler delegate to show background task progress while the app is in the foreground.

private async void OnProgress(IBackgroundTaskRegistration task, BackgroundTaskProgressEventArgs args)
{
    //
    // UI element updates should be done asynchronously.
    //
    await Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
    () =>
    {
        ExampleProgressElement.Text = "Progress is at " args.Progress + "%.";
    });
}

Remarks

The system generates this class and passes it as an argument to the application's BackgroundTaskProgressEventHandler handler.

Properties

InstanceId

Gets the identifier of the background task instance for this progress status notification.

Progress

Gets progress status for a background task instance.

Applies to