Scheduled​Tile​Notification Scheduled​Tile​Notification Scheduled​Tile​Notification Class

Definition

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

public sealed class ScheduledTileNotification : IScheduledTileNotificationpublic sealed class ScheduledTileNotification : IScheduledTileNotificationPublic NotInheritable Class ScheduledTileNotification Implements IScheduledTileNotification
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
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)

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

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

The object that provides the content for the tile notification.

deliveryTime
DateTime DateTime DateTime

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

Attributes

Remarks

Examples

The following example, which shows a tile scheduled to display in one hour, includes the use of the ScheduledTileNotification 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);
See Also

Properties

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

The object that contains the notification content.

Attributes

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.

See Also

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 DateTimeOffset
Value
DateTime DateTime DateTime

The date and time that the notification will be updated.

Attributes

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 TileUpdater.addToSchedule method.

See Also

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

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

Attributes
See Also

Id Id Id

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

public PlatForm::String Id { get; set; }public string Id { get; set; }Public ReadWrite Property Id As string
Value
string string string

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

Attributes

Remarks

ScheduledTileNotification.tag and ScheduledTileNotification.id serve similar purposes:

  • The ScheduledTileNotification.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

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

public PlatForm::String Tag { get; set; }public string Tag { get; set; }Public ReadWrite Property Tag As string
Value
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

Remarks

ScheduledTileNotification.tag and ScheduledTileNotification.id serve similar purposes:

  • The ScheduledTileNotification.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 ScheduledTileNotification.id property identifies the notification in the schedule. This allows the notification to be identified or removed from the schedule.
See Also

See Also