Background​Task​Progress​Event​Args Background​Task​Progress​Event​Args Background​Task​Progress​Event​Args Background​Task​Progress​Event​Args Class

Definition

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

public : sealed class BackgroundTaskProgressEventArgs : IBackgroundTaskProgressEventArgspublic sealed class BackgroundTaskProgressEventArgs : IBackgroundTaskProgressEventArgsPublic NotInheritable Class BackgroundTaskProgressEventArgs Implements IBackgroundTaskProgressEventArgs// You can use this class in JavaScript.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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 InstanceId InstanceId InstanceId

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

public : PlatForm::Guid InstanceId { get; }public Guid InstanceId { get; }Public ReadOnly Property InstanceId As Guid// You can use this property in JavaScript.
Value
PlatForm::Guid Guid Guid Guid

A unique identifier generated by the system when it creates the background task instance.

Progress Progress Progress Progress

Gets progress status for a background task instance.

public : unsigned short Progress { get; }public uint Progress { get; }Public ReadOnly Property Progress As uint// You can use this property in JavaScript.
Value
unsigned short uint uint uint

A value defined by the application to indicate the task's progress.