Freigeben über


AppNotificationBuilder.SetDuration(AppNotificationDuration) Methode

Definition

Legt die Dauer für eine App-Benachrichtigung fest.

public:
 virtual AppNotificationBuilder ^ SetDuration(AppNotificationDuration duration) = SetDuration;
AppNotificationBuilder SetDuration(AppNotificationDuration const& duration);
public AppNotificationBuilder SetDuration(AppNotificationDuration duration);
function setDuration(duration)
Public Function SetDuration (duration As AppNotificationDuration) As AppNotificationBuilder

Parameter

duration
AppNotificationDuration

Ein Wert aus der AppNotificationDuration Enumeration, die die Dauer für die App-Benachrichtigung angibt.

Gibt zurück

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

Beispiele

Im folgenden Beispiel wird das Festlegen der Dauer in der XML-Nutzlast für eine App-Benachrichtigung veranschaulicht.

var notification = new AppNotificationBuilder()
    .AddText("Notification text.")
    .SetDuration(AppNotificationDuration.Long)
    .BuildNotification();

AppNotificationManager.Default.Show(notification);

Die resultierende XML-Nutzlast:

<toast duration='long'>
    <visual>
        <binding template='ToastGeneric'>
            <text>Notification text.</text>
        </binding>
    </visual>
</toast>

Hinweise

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: