我有一个应用程序框架(在JavaScript中),它动态设置实时图块供稿的URL。在我的代码中我有类似下面的东西,这适用于宽瓷砖,但当我将瓷砖调整为“中等”(或“小”)时,实时馈送/更新消失了。如果我重新调整大小,它就可以了。没有其他平铺设置(它使用默认设置)。
我的问题是:无论如何都要同时更新所有磁贴大小,或者我是否必须使用getTemplateContent()
和TileUpdater的{{1}来构建完整的XML对象方法?
我目前更新周期性网址(同样,这适用于宽图块):
update()
答案 0 :(得分:1)
要在单个更新中更新多个切片大小,该更新的XML有效内容必须包含每个切片大小的单个元素。
您可以在SDK中的App tiles and badges sample中看到这一点。例如,场景1演示了如何使用(a)C#NotificationExtensions库,(b)将XML构建为字符串,以及(c)使用getTemplateContent来实现此目的。其中一种方法应该适合你。
举一个案例(a)的例子,这里是场景1中的代码,它还有一个注释解释更多:
// This sample application supports all four tile sizes – small (Square70x70), medium (Square150x150), wide (Wide310x150) and large (Square310x310).
// This means that the user may have resized their tile to any of these four sizes for their custom Start screen layout.
// Because an app has no way of knowing what size the user resized their app tile to, an app should include template bindings
// for each supported tile sizes in their notifications. The only exception is the small (Square70x70) tile size because this size
// does not support live tile notifications, which is why there are no Square70x70 tile templates.
// We assemble one notification with three template bindings by including the content for each smaller
// tile in the next size up. Square310x310 includes Wide310x150, which includes Square150x150.
// If we leave off the content for a tile size which the application supports, the user will not see the
// notification if the tile is set to that size.
// Create a notification for the Square310x310 tile using one of the available templates for the size.
var tileContent = NotificationsExtensions.TileContent.TileContentFactory.createTileSquare310x310Text09();
tileContent.textHeadingWrap.text = "Hello World! My very own tile notification";
// Create a notification for the Wide310x150 tile using one of the available templates for the size.
var wide310x150Content = NotificationsExtensions.TileContent.TileContentFactory.createTileWide310x150Text03();
wide310x150Content.textHeadingWrap.text = "Hello World! My very own tile notification";
// Create a notification for the Square150x150 tile using one of the available templates for the size.
var square150x150Content = NotificationsExtensions.TileContent.TileContentFactory.createTileSquare150x150Text04();
square150x150Content.textBodyWrap.text = "Hello World! My very own tile notification";
// Attach the Square150x150 template to the Wide310x150 template.
wide310x150Content.square150x150Content = square150x150Content;
// Attach the Wide310x150 template to the Square310x310 template.
tileContent.wide310x150Content = wide310x150Content;
// Send the notification to the application’s tile.
Windows.UI.Notifications.TileUpdateManager.createTileUpdaterForApplication().update(tileContent.createNotification());