AppNotificationBuilder.SetAudioEvent Methode
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Überlädt
| Name | Beschreibung |
|---|---|
| SetAudioEvent(AppNotificationSoundEvent) |
Legt das Audioereignis für eine App-Benachrichtigung fest. |
| SetAudioEvent(AppNotificationSoundEvent, AppNotificationAudioLooping) |
Legt das Audioereignis- und Schleifenverhalten für eine App-Benachrichtigung fest. |
SetAudioEvent(AppNotificationSoundEvent)
Legt das Audioereignis für eine App-Benachrichtigung fest.
public:
virtual AppNotificationBuilder ^ SetAudioEvent(AppNotificationSoundEvent appNotificationSoundEvent) = SetAudioEvent;
/// [Windows.Foundation.Metadata.Overload("SetAudioEvent")]
AppNotificationBuilder SetAudioEvent(AppNotificationSoundEvent const& appNotificationSoundEvent);
[Windows.Foundation.Metadata.Overload("SetAudioEvent")]
public AppNotificationBuilder SetAudioEvent(AppNotificationSoundEvent appNotificationSoundEvent);
function setAudioEvent(appNotificationSoundEvent)
Public Function SetAudioEvent (appNotificationSoundEvent As AppNotificationSoundEvent) As AppNotificationBuilder
Parameter
- appNotificationSoundEvent
- AppNotificationSoundEvent
Ein Element der AppNotificationSoundEvent-Aufzählung , die einen zu wiedergebenden Systemsound angibt.
Gibt zurück
Gibt die AppNotificationBuilder- Instanz zurück, sodass zusätzliche Methodenaufrufe verkettet werden können.
- Attribute
Beispiele
Im folgenden Beispiel wird das Festlegen eines Audioereignisses in der XML-Nutzlast für eine App-Benachrichtigung veranschaulicht.
var notification = new AppNotificationBuilder()
.AddText("Notification text.")
.SetAudioEvent(AppNotificationSoundEvent.Alarm)
.BuildNotification();
AppNotificationManager.Default.Show(notification);
Die resultierende XML-Nutzlast:
<toast>
<visual>
<binding template='ToastGeneric'>
<text>Notification text.</text>
</binding>
</visual>
<audio src='ms-winsoundevent:Notification.Looping.Alarm'/>
</toast>
Hinweise
Mit dieser Methode können Sie eine konsistente Audioumgebung bereitstellen, indem Sie einen Audioereignistyp angeben, der standardisierte Systemsounds verwendet. Sie können einen benutzerdefinierten Sound für eine App-Benachrichtigung angeben, indem Sie SetAudioUri aufrufen.
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:
SetAudioEvent(AppNotificationSoundEvent, AppNotificationAudioLooping)
Legt das Audioereignis- und Schleifenverhalten für eine App-Benachrichtigung fest.
public:
virtual AppNotificationBuilder ^ SetAudioEvent(AppNotificationSoundEvent appNotificationSoundEvent, AppNotificationAudioLooping loop) = SetAudioEvent;
/// [Windows.Foundation.Metadata.Overload("SetAudioEvent2")]
AppNotificationBuilder SetAudioEvent(AppNotificationSoundEvent const& appNotificationSoundEvent, AppNotificationAudioLooping const& loop);
[Windows.Foundation.Metadata.Overload("SetAudioEvent2")]
public AppNotificationBuilder SetAudioEvent(AppNotificationSoundEvent appNotificationSoundEvent, AppNotificationAudioLooping loop);
function setAudioEvent(appNotificationSoundEvent, loop)
Public Function SetAudioEvent (appNotificationSoundEvent As AppNotificationSoundEvent, loop As AppNotificationAudioLooping) As AppNotificationBuilder
Parameter
- appNotificationSoundEvent
- AppNotificationSoundEvent
Ein Element der AppNotificationSoundEvent-Aufzählung , die einen zu wiedergebenden Systemsound angibt.
Ein Element der AppNotificationAudioLooping-Aufzählung , die das Schleifenverhalten für das Audio angibt.
Gibt zurück
Gibt die AppNotificationBuilder- Instanz zurück, sodass zusätzliche Methodenaufrufe verkettet werden können.
- Attribute
Beispiele
Im folgenden Beispiel wird das Festlegen eines Audioereignisses in der XML-Nutzlast für eine App-Benachrichtigung veranschaulicht.
var notification = new AppNotificationBuilder()
.AddText("Notification text.")
.SetAudioEvent(AppNotificationSoundEvent.Alarm, AppNotificationAudioLooping.Loop)
.BuildNotification();
AppNotificationManager.Default.Show(notification);
Die resultierende XML-Nutzlast:
<toast>
<visual>
<binding template='ToastGeneric'>
<text>Notification text.</text>
</binding>
</visual>
<audio src='ms-winsoundevent:Notification.Looping.Alarm' loop='true'/>
</toast>
Hinweise
Mit dieser Methode können Sie eine konsistente Audioumgebung bereitstellen, indem Sie einen Audioereignistyp angeben, der standardisierte Systemsounds verwendet. Sie können einen benutzerdefinierten Sound für eine App-Benachrichtigung angeben, indem Sie SetAudioUri aufrufen.
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.