ScheduledTileNotification.Id Свойство
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Возвращает или задает уникальный идентификатор, используемый для идентификации запланированной плитки в расписании.
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
Значение свойства
Идентификатор уведомления. Длина этой строки ограничена 16 символами.
Примеры
В следующем примере, в котором показана плитка, которая должна отображаться в течение одного часа, используется свойство Id для добавления меток к запланированному уведомлению.
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);
Комментарии
ScheduledTileNotification.tag и ScheduledTileNotification.id служат аналогичным целям:
- Свойство ScheduledTileNotification.tag используется Windows, чтобы предотвратить одновременное появление повторяющегося содержимого уведомлений в очереди. Это позволяет обновлять уведомление на месте в очереди, чтобы предотвратить его отображение устаревших сведений.
- Свойство id определяет уведомление в расписании. Это позволяет определить или удалить уведомление из расписания.