Windows 8 通知与后台任务开发指南
1. 清晰通知的提供
在 Windows 8 开发中,通知功能是吸引用户注意力的重要手段,主要包括 Toast 通知和磁贴通知。
1.1 磁贴通知示例
以下代码展示了如何创建一个末日设备汇总的磁贴通知:
btn_tile.onclick = function () { count++; var tile_xml = Windows.UI.Notifications.TileUpdateManager .getTemplateContent(Windows.UI.Notifications.TileTemplateType .tileWideBlockAndText01 ); var text_nodes = tile_xml.documentElement.getElementsByTagName("text"); text_nodes[0].appendChild(tile_xml.createTextNode(count + " food")); text_nodes[1].appendChild(tile_xml.createTextNode( (count + 1).toString() + " drink")); text_nodes[2].appendChild(tile_xml.createTextNode( (count + 2).toString() + " maps")); text_nodes[3]