ScheduledTileNotification Classe

Définition

Définit le contenu visuel et le minutage d’une mise à jour planifiée non périodique d’une vignette.

public ref class ScheduledTileNotification sealed
/// [Windows.Foundation.Metadata.Activatable(Windows.UI.Notifications.IScheduledTileNotificationFactory, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
class ScheduledTileNotification 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.IScheduledTileNotificationFactory, 65536, "Windows.Foundation.UniversalApiContract")]
class ScheduledTileNotification 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.IScheduledTileNotificationFactory, 65536, "Windows.Foundation.UniversalApiContract")]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class ScheduledTileNotification final
[Windows.Foundation.Metadata.Activatable(typeof(Windows.UI.Notifications.IScheduledTileNotificationFactory), 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 ScheduledTileNotification
[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.IScheduledTileNotificationFactory), 65536, "Windows.Foundation.UniversalApiContract")]
public sealed class ScheduledTileNotification
[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.IScheduledTileNotificationFactory), 65536, "Windows.Foundation.UniversalApiContract")]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class ScheduledTileNotification
function ScheduledTileNotification(content, deliveryTime)
Public NotInheritable Class ScheduledTileNotification
Héritage
Object Platform::Object IInspectable ScheduledTileNotification
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 vignette planifiée pour s’afficher en 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.

var tileXml = Notifications.TileUpdateManager.getTemplateContent(Notifications.TileTemplateType.tileWide310x150Text09);

// Set up the wide tile text.
var tileTextAttributes = tileXml.getElementsByTagName("text");
tileTextAttributes[0].appendChild(tileXml.createTextNode("This is a scheduled notification"));
tileTextAttributes[1].appendChild(tileXml.createTextNode("Received: " + dueTime.toLocaleTimeString()));

// Set up the medium tile text.
var squareTileXml = Notifications.TileUpdateManager.getTemplateContent(Notifications.TileTemplateType.tileSquare150x150Text04);
var squareTileTextAttributes = squareTileXml.getElementsByTagName("text");
squareTileTextAttributes[0].appendChild(squareTileXml.createTextNode("This is a scheduled notification"));

// Include the medium tile in the notification.
var node = tileXml.importNode(squareTileXml.getElementsByTagName("binding").item(0), true);
tileXml.getElementsByTagName("visual").item(0).appendChild(node);

// Create the notification object.
var futureTile = new Notifications.ScheduledTileNotification(tileXml, dueTime);
futureTile.id = "Tile" + idNumber;

// Add to the schedule.
Notifications.TileUpdateManager.createTileUpdaterForApplication().addToSchedule(futureTile);

Constructeurs

ScheduledTileNotification(XmlDocument, DateTime)

Crée et initialise une nouvelle instance de l’objet ScheduledTileNotification à utiliser avec un TileUpdater.

Propriétés

Content

Obtient la description XML du contenu de la mise à jour planifiée des vignettes.

DeliveryTime

Obtient l’heure à laquelle la vignette est planifiée pour être mise à jour.

ExpirationTime

Obtient ou définit l’heure après laquelle la notification de vignette ne doit plus être affichée. Par défaut, une notification de vignette n’expire pas. Il est recommandé de définir explicitement un délai d’expiration pour éviter le contenu obsolète.

Id

Obtient ou définit l’ID unique utilisé pour identifier la vignette planifiée dans la planification.

Tag

Obtient ou définit une chaîne que Windows peut utiliser pour empêcher l’affichage du contenu de notification en double dans la file d’attente.

S’applique à