ScheduledToastNotification Classe

Définition

Contient le code XML qui définit la notification toast qui s’affichera à l’heure planifiée.

public ref class ScheduledToastNotification sealed
/// [Windows.Foundation.Metadata.Activatable(Windows.UI.Notifications.IScheduledToastNotificationFactory, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
class ScheduledToastNotification final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
/// [Windows.Foundation.Metadata.Activatable(Windows.UI.Notifications.IScheduledToastNotificationFactory, 65536, "Windows.Foundation.UniversalApiContract")]
class ScheduledToastNotification final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
/// [Windows.Foundation.Metadata.Activatable(Windows.UI.Notifications.IScheduledToastNotificationFactory, 65536, "Windows.Foundation.UniversalApiContract")]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class ScheduledToastNotification final
[Windows.Foundation.Metadata.Activatable(typeof(Windows.UI.Notifications.IScheduledToastNotificationFactory), 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
public sealed class ScheduledToastNotification
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.UI.Notifications.IScheduledToastNotificationFactory), 65536, "Windows.Foundation.UniversalApiContract")]
public sealed class ScheduledToastNotification
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.UI.Notifications.IScheduledToastNotificationFactory), 65536, "Windows.Foundation.UniversalApiContract")]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class ScheduledToastNotification
function ScheduledToastNotification(content, deliveryTime, snoozeInterval, maximumSnoozeCount)
Public NotInheritable Class ScheduledToastNotification
Héritage
Object Platform::Object IInspectable ScheduledToastNotification
Attributs

Configuration requise pour Windows

Famille d’appareils
Windows 10 (introduit dans 10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduit dans v1.0)

Exemples

L’exemple suivant montre une notification toast planifiée pour s’afficher dans une heure.

var Notifications = Windows.UI.Notifications;
var currentTime = new Date();
var seconds = 60;
var dueTime = new Date(currentTime.getTime() + seconds * 60 * 1000);
var idNumber = Math.floor(Math.random() * 100000000);  // Generates a unique ID number for the notification.

// Set up the notification text.
var toastXml = Notifications.ToastNotificationManager.getTemplateContent(Notifications.ToastTemplateType.toastText02);
var strings = toastXml.getElementsByTagName("text");
strings[0].appendChild(toastXml.createTextNode(This is a scheduled toast notification));
strings[1].appendChild(toastXml.createTextNode("Received: " + dueTime.toLocaleTimeString()));

// Create the toast notification object.
var toast = new Notifications.ScheduledToastNotification(toastXml, dueTime);
toast.id = "Toast" + idNumber;

// Add to the schedule.
Notifications.ToastNotificationManager.createToastNotifier().addToSchedule(toast);

Remarques

Créez et initialisez une nouvelle instance de cet objet en appelant ScheduledToastNotification.

Historique des versions

Version de Windows Version du SDK Valeur ajoutée
1607 14393 NotificationMirroring
1607 14393 RemoteId
1803 17134 ExpirationTime

Constructeurs

ScheduledToastNotification(XmlDocument, DateTime)

Crée et initialise une nouvelle instance d’une scheduledToastNotification qui ne sera affichée qu’une seule fois.

ScheduledToastNotification(XmlDocument, DateTime, TimeSpan, UInt32)

Déconseillé dans Windows 10. Sur Windows 8 systèmes, crée et initialise une nouvelle instance d’un ScheduledToastNotification qui réapparaît après une heure spécifiée après l’apparition initiale. Sur Windows 10, cela fonctionne de manière équivalente à ScheduledToastNotification(XmlDocument, DateTime). Pour obtenir le même comportement d’intervalle de veille dans Windows 10, vous pouvez utiliser des boutons sur vos toasts.

Propriétés

Content

Obtient le code XML qui définit cette notification toast planifiée.

DeliveryTime

Obtient l’heure à laquelle cette notification toast est planifiée pour être affichée.

ExpirationTime

Obtient ou définit l’heure d’expiration de la notification.

Group

Obtient ou définit l’identificateur de groupe pour la notification.

Id

Obtient une valeur spécifiée par le développeur utilisée pour identifier un toast planifié spécifique.

MaximumSnoozeCount

Obtient le nombre maximal de fois pour afficher cette notification.

NotificationMirroring

Obtient ou définit une valeur qui spécifie si la mise en miroir des notifications est activée. (La mise en miroir de notifications permet à une notification d’apparaître sur plusieurs appareils.)

RemoteId

Obtient ou définit un ID distant pour la notification qui permet au système de mettre en corrélation cette notification avec une autre générée sur un autre appareil.

SnoozeInterval

Obtient la durée entre les occurrences de la notification.

SuppressPopup

Obtient ou définit si l’interface utilisateur contextuelle d’un toast s’affiche sur l’écran de l’utilisateur.

Tag

Obtient ou définit une chaîne qui identifie de manière unique une notification toast à l’intérieur d’un groupe.

S’applique à

Voir aussi