Freigeben über


AppNotificationBuilder.AddProgressBar(AppNotificationProgressBar) Methode

Definition

Fügt der XML-Nutzlast für eine App-Benachrichtigung eine Statusanzeige hinzu.

public:
 virtual AppNotificationBuilder ^ AddProgressBar(AppNotificationProgressBar ^ value) = AddProgressBar;
AppNotificationBuilder AddProgressBar(AppNotificationProgressBar const& value);
public AppNotificationBuilder AddProgressBar(AppNotificationProgressBar value);
function addProgressBar(value)
Public Function AddProgressBar (value As AppNotificationProgressBar) As AppNotificationBuilder

Parameter

value
AppNotificationProgressBar

Eine AppNotificationProgressBar, die die Statusanzeige darstellt, die der Benachrichtigung hinzugefügt werden soll.

Gibt zurück

Gibt die AppNotificationBuilder- Instanz zurück, sodass zusätzliche Methodenaufrufe verkettet werden können.

Beispiele

Das folgende Beispiel veranschaulicht das Hinzufügen eines Kombinationsfelds zu einer App-Benachrichtigung.

var builder = new AppNotificationBuilder()
        .AddText("Downloading this week's new music...")
        .AddProgressBar(new AppNotificationProgressBar()
            .BindTitle()
            .BindValueStringOverride());

    var data = new AppNotificationProgressData(1 /* Sequence number */);
    data.Title = "Artist Name"; // Binds to {progressTitle} in xml payload
    data.Value = 0.5; // Binds to {progressValue} in xml payload
    data.ValueStringOverride = "1/2 songs"; // Binds to {progressValueString} in xml payload
    data.Status = "Downloading..."; // Binds to {progressStatus} in xml payload

    var notification = builder.BuildNotification();
    notification.Progress = data;

    AppNotificationManager.Default.Show(notification);

Die resultierende XML-Nutzlast:

<toast>
    <visual>
        <binding template='ToastGeneric'>
            <text>Downloading this week&apos;s new music...</text>
            <progress title='{progressTitle}' status='{progressStatus}' value='{progressValue}' valueStringOverride='{progressValueString}'/>
        </binding>
    </visual>
</toast>

Hinweise

Binden Sie die Felder eines AppNotificationProgressData-, um die Anfangswerte und den aktualisierten Status der Statusanzeige festzulegen. Informationen zur Datenbindung an eine Statusleiste in einer App-Benachrichtigung finden Sie unter Statusleiste der App-Benachrichtigung und datenbindung.

Anleitungen zur Verwendung der AppNotificationBuilder--APIs zum Erstellen der Benutzeroberfläche für App-Benachrichtigungen finden Sie unter App-Benachrichtigungsinhalt.

Referenzinformationen zum XML-Schema für App-Benachrichtigungen finden Sie unter App-Benachrichtigungsinhaltsschema.

Gilt für: