TileUpdater 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
更改更新程序绑定到的特定磁贴的内容。
public ref class TileUpdater sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
class TileUpdater final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class TileUpdater final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public sealed class TileUpdater
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class TileUpdater
Public NotInheritable Class TileUpdater
- 继承
- 属性
Windows 要求
设备系列 |
Windows 10 (在 10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox 中引入)
|
API contract |
Windows.Foundation.UniversalApiContract (在 v1.0 中引入)
|
示例
以下示例显示了用于向应用磁贴发送通知的 Update 。
function sendTileTextNotification() {
var Notifications = Windows.UI.Notifications;
// Get an XML DOM version of a specific template by using getTemplateContent.
var tileXml = Notifications.TileUpdateManager.getTemplateContent(Notifications.TileTemplateType.tileWide310x150Text03);
// You will need to look at the template documentation to know how many text fields a particular template has.
// Get the text attribute for this template and fill it in.
var tileAttributes = tileXml.getElementsByTagName("text");
tileAttributes[0].appendChild(tileXml.createTextNode("Hello World!"));
// Create the notification from the XML.
var tileNotification = new Notifications.TileNotification(tileXml);
// Send the notification to the calling app's tile.
Notifications.TileUpdateManager.createTileUpdaterForApplication().update(tileNotification);
}
以下代码行使用 EnableNotificationQueue 为调用应用的磁贴启用通知队列。
Windows.UI.Notifications.TileUpdateManager.createTileUpdaterForApplication().enableNotificationQueue(true);
以下示例演示如何使用 RemoveFromSchedule 方法。
var notifier = Notifications.TileUpdateManager.createTileUpdaterForApplication();
var scheduled = notifier.getScheduledTileNotifications();
for (var i = 0, len = scheduled.length; i < len; i++) {
// The itemId value is the unique ScheduledTileNotification.Id assigned to the
// notification when it was created.
if (scheduled[i].id === itemId) {
notifier.removeFromSchedule(scheduled[i]);
}
}
注解
若要获取此对象的实例,请调用 TileUpdateManager.CreateTileUpdaterForApplication 或 TileUpdateManager.CreateTileUpdaterForSecondaryTile 方法。
创建时,TileUpdater 将绑定到特定应用或辅助磁贴,因此此类的方法仅影响对象实例绑定到的单个磁贴。
属性
Setting |
获取一个值,该值指定是否可以通过通知更新磁贴。 |