Поделиться через


ScheduledTileNotification(XmlDocument, DateTime) Конструктор

Определение

Создает и инициализирует новый экземпляр объекта ScheduledTileNotification для использования с TileUpdater.

public:
 ScheduledTileNotification(XmlDocument ^ content, DateTime deliveryTime);
 ScheduledTileNotification(XmlDocument const& content, DateTime const& deliveryTime);
public ScheduledTileNotification(XmlDocument content, System.DateTimeOffset deliveryTime);
function ScheduledTileNotification(content, deliveryTime)
Public Sub New (content As XmlDocument, deliveryTime As DateTimeOffset)

Параметры

content
XmlDocument

Объект , предоставляющий содержимое для уведомления плитки.

deliveryTime
DateTime DateTimeOffset

Время, когда плитка должна быть обновлена с помощью сведений об уведомлении.

Примеры

В следующем примере, в котором показана плитка, отображаемая в течение одного часа, используется конструктор ScheduledTileNotification для создания объекта уведомления.

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

Применяется к

См. также раздел