精简
计划磁贴通知
//指定模板
TileTemplateType tileTemplate = TileTemplateType.TileWideImageAndText01;
XmlDocument tileXml = TileUpdateManager.GetTemplateContent(tileTemplate);
//提供通知内容
//设置文字
XmlNodeList tileTextAttributes = tileXml.GetElementsByTagName("text");
tileTextAttributes[0].InnerText = "Hello"+Guid.NewGuid().ToString().Substring(0,5)+" World!!!!!";
//设置图片
XmlNodeList tileImageAttributes = tileXml.GetElementsByTagName("image");
((XmlElement)tileImageAttributes[0]).SetAttribute("src", "ms-appx:///images//1024.png");
((XmlElement)tileImageAttributes[0]).SetAttribute("alt", "red graphic");
//小瓷贴模版。
XmlDocument squareTileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquareText04);
//设置文字
XmlNodeList squareTileTextAttributes = squareTileXml.GetElementsByTagName("text");
squareTileTextAttributes[0].AppendChild(squareTileXml.CreateTextNode("Hello " + Guid.NewGuid().ToString().Substring(0, 5) + " World。。。。"));
//绑定
IXmlNode node = tileXml.ImportNode(squareTileXml.GetElementsByTagName("binding").Item(0), true);
//插入
tileXml.GetElementsByTagName("visual").Item(0).AppendChild(node);
//指定应传递通知的时间
//Int16 dueTimeInHours = 3;
//DateTime dueTime = DateTime.Now.AddHours(dueTimeInHours);
DateTime dueTim1e = DateTime.Now.AddSeconds(10);
//创建计划的磁贴通知对象
ScheduledTileNotification scheduledTile = new ScheduledTileNotification(tileXml, dueTim1e);
//为计划的磁贴通知赋予 ID
scheduledTile.Id = "Future_Tile";
//向计划中添加磁贴通知。
TileUpdateManager.CreateTileUpdaterForApplication().AddToSchedule(scheduledTile);
磁贴通知队列
清除磁贴通知
参考实例:http://code.msdn.microsoft.com/windowsapps/app-tiles-and-badges-sample-5fc49148/