ScheduledTileNotification.Id Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the unique ID that is used to identify the scheduled tile in the schedule.
public:
property Platform::String ^ Id { Platform::String ^ get(); void set(Platform::String ^ value); };
winrt::hstring Id();
void Id(winrt::hstring value);
public string Id { get; set; }
var string = scheduledTileNotification.id;
scheduledTileNotification.id = string;
Public Property Id As String
Property Value
The notification's identifier. This string is limited to 16 characters.
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);
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.