ScheduledTileNotification ScheduledTileNotification ScheduledTileNotification ScheduledTileNotification Class

Defines the visual content and timing for a single, non-recurring scheduled update to a tile.

Syntax

Declaration

public sealed class ScheduledTileNotificationpublic sealed class ScheduledTileNotificationPublic NotInheritable Class ScheduledTileNotificationpublic sealed class ScheduledTileNotification

Remarks

Examples

The following example shows a tile scheduled to display in one hour.


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);

Constructors summary

Creates and initializes a new instance of the ScheduledTileNotification object for use with a TileUpdater.

Properties summary

Gets the XML description of the content of the scheduled tile update.

Gets the time at which the tile is scheduled to be updated.

Gets or sets the time after which the tile notification should no longer be shown. By default, a tile notification does not expire. It is a best practice to explicitly set an expiration time to avoid stale content.

Gets or sets the unique ID that is used to identify the scheduled tile in the schedule.

Gets or sets a string that Windows can use to prevent duplicate notification content from appearing in the queue.

Constructors

  • ScheduledTileNotification(XmlDocument, DateTime)
    ScheduledTileNotification(XmlDocument, DateTime)
    ScheduledTileNotification(XmlDocument, DateTime)
    ScheduledTileNotification(XmlDocument, DateTime)

    Creates and initializes a new instance of the ScheduledTileNotification object for use with a TileUpdater.

    public ScheduledTileNotification(XmlDocument content, DateTime deliveryTime)public New(XmlDocument content, DateTime deliveryTime)Public Sub New(content As XmlDocument, deliveryTime As DateTime)public ScheduledTileNotification(XmlDocument content, DateTime deliveryTime)

    Parameters

    Remarks

    Examples

    The following example, which shows a tile scheduled to display in one hour, includes the use of the @Windows.UI.Notifications.ScheduledTileNotification.#ctor(Windows.Data.Xml.Dom.XmlDocument,Windows.Foundation.DateTime) constructor to create the notification object.

    
    
    var Notifications = Windows.UI.Notifications;
    var currentTime = new Date();
    var seconds = 60;
    var dueTime = new Date(currentTime.getTime() + seconds * 60 * 1000);
    var idNumber = 123456789;
    
    
    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);
    

Properties

  • Content
    Content
    Content
    Content

    Gets the XML description of the content of the scheduled tile update.

    public XmlDocument Content { get; }public XmlDocument Content { get; }Public ReadOnly Property Content As XmlDocumentpublic XmlDocument Content { get; }

    Property Value

    Remarks

    This information is set when the ScheduledTileNotification is created.

    The retrieved elements and their attributes are manipulated through Document Object Model (DOM) manipulation functions. See Tile schema for an explanation of tile elements and attributes found in the XML document.

  • DeliveryTime
    DeliveryTime
    DeliveryTime
    DeliveryTime

    Gets the time at which the tile is scheduled to be updated.

    public DateTime DeliveryTime { get; }public DateTimeOffset DeliveryTime { get; }Public ReadOnly Property DeliveryTime As DateTimeOffsetpublic DateTime DeliveryTime { get; }

    Property Value

    Remarks

    This value is set when the ScheduledTileNotification is created. For the tile to be updated at the specified time, the notification must be added to the schedule through the AddToSchedule(ScheduledTileNotification) method.

  • ExpirationTime
    ExpirationTime
    ExpirationTime
    ExpirationTime

    Gets or sets the time after which the tile notification should no longer be shown. By default, a tile notification does not expire. It is a best practice to explicitly set an expiration time to avoid stale content.

    public IReference<DateTime> ExpirationTime { get; set; }public IReference<DateTime> ExpirationTime { get; set; }Public ReadWrite Property ExpirationTime As IReference<DateTime>public IReference<DateTime> ExpirationTime { get; set; }

    Property Value

    • The time after which the tile update should no longer be shown.

  • Id
    Id
    Id
    Id

    Gets or sets the unique ID that is used to identify the scheduled tile in the schedule.

    public string Id { get; set; }public string Id { get; set; }Public ReadWrite Property Id As stringpublic string Id { get; set; }

    Property Value

    • string
      string
      string
      string

      The notification's identifier. This string is limited to 16 characters.

    Remarks

    Tag and Id serve similar purposes:

    • The Tag property is used by Windows to prevent duplicate notification content from appearing in the queue at the same time. It allows the notification to be updated in-place in the queue to prevent it from containing out-of-date information.
    • The Id property identifies the notification in the schedule. This allows the notification to be identified or removed from the schedule.

    Examples

    The following example, which shows a tile scheduled to display in one hour, includes the use of the Id property to label the scheduled notification.

    
    var Notifications = Windows.UI.Notifications;
    var currentTime = new Date();
    var seconds = 60;
    var dueTime = new Date(currentTime.getTime() + seconds * 60 * 1000);
    var idNumber = 123456789;
    
    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);
    
  • Tag
    Tag
    Tag
    Tag

    Gets or sets a string that Windows can use to prevent duplicate notification content from appearing in the queue.

    public string Tag { get; set; }public string Tag { get; set; }Public ReadWrite Property Tag As stringpublic string Tag { get; set; }

    Property Value

    • string
      string
      string
      string

      A string of 16 characters or less (plus a terminating null character) that identifies the notification in the stack. While there is no set form for the string content, we recommend that it should relate to the content of the notification.

    Remarks

    Tag and Id serve similar purposes:

    • The Tag property is used by Windows to prevent duplicate notification content from appearing in the queue at the same time. It allows the notification to be updated in-place in the queue to prevent it from containing out-of-date information.
    • The Id property identifies the notification in the schedule. This allows the notification to be identified or removed from the schedule.

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ActivatableAttribute
Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.MuseAttribute
Windows.Foundation.Metadata.ThreadingAttribute

Details

Assembly

Windows.UI.Notifications.dll