ScheduledTileNotification ScheduledTileNotification ScheduledTileNotification ScheduledTileNotification Class

Definition

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

public sealed class ScheduledTileNotificationpublic sealed class ScheduledTileNotificationPublic NotInheritable Class ScheduledTileNotificationpublic sealed class ScheduledTileNotification
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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

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
content
XmlDocument XmlDocument XmlDocument XmlDocument

The object that provides the content for the tile notification.

deliveryTime
DateTime DateTime DateTime DateTime

The time at which the tile should be updated with the notification information.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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; }
Value
XmlDocument XmlDocument XmlDocument XmlDocument

The object that contains the notification content.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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; }
Value
DateTime DateTime DateTime DateTime

The date and time that the notification will be updated.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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; }
Value

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

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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; }
Value
string string string string

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

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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; }
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.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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.