BackgroundTaskProgressEventArgs Classe

Définition

Représente les informations de progression d’une tâche au moment de l’envoi d’une notification de mise à jour de progression.

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
Héritage
Object Platform::Object IInspectable BackgroundTaskProgressEventArgs
Attributs

Configuration requise pour Windows

Famille d’appareils
Windows 10 (introduit dans 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduit dans v1.0)

Exemples

L’exemple suivant montre comment utiliser la classe BackgroundTaskProgressEventArgs avec un délégué BackgroundTaskProgressEventHandler pour afficher la progression de la tâche en arrière-plan pendant que l’application est au premier plan.

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

Remarques

Le système génère cette classe et la transmet en tant qu’argument au gestionnaire BackgroundTaskProgressEventHandler de l’application.

Propriétés

InstanceId

Obtient l’identificateur de la tâche en arrière-plan instance pour cette notification de progression status.

Progress

Obtient le status de progression d’une tâche en arrière-plan instance.

S’applique à