BackgroundTaskProgressEventArgs Klasse

Definition

Stellt Statusinformationen für eine Aufgabe zum Zeitpunkt des Sendens einer Statusaktualisierungsbenachrichtigung dar.

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 final
[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
Vererbung
Object Platform::Object IInspectable BackgroundTaskProgressEventArgs
Attribute

Windows-Anforderungen

Gerätefamilie
Windows 10 (eingeführt in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (eingeführt in v1.0)

Beispiele

Das folgende Beispiel zeigt, wie die BackgroundTaskProgressEventArgs-Klasse mit einem BackgroundTaskProgressEventHandler-Delegaten verwendet wird, um den Fortschritt der Hintergrundaufgaben anzuzeigen, während sich die App im Vordergrund befindet.

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 + "%.";
    });
}

Hinweise

Das System generiert diese Klasse und übergibt sie als Argument an den BackgroundTaskProgressEventHandler-Handler der Anwendung.

Eigenschaften

InstanceId

Ruft den Bezeichner der Hintergrundaufgabe ab, instance für diese Statusbenachrichtigung status.

Progress

Ruft den Status status für eine Hintergrundaufgabe instance ab.

Gilt für: