C# 使用C语言的Windows8LiveTile后台代理#
我尝试在Windows 8上每隔一段时间更新一次live互动程序,即使应用程序本身没有运行,我也需要这样做。上列出的通知选项都不合适,我想轮询系统信息,如CPU温度等,这不适合列出的通知样式 我在StackOverflow的其他地方也看到过类似的问题,但WindowsPhone7除外。对我来说,使用背景工作者似乎也是正确的答案。然而,与前一个教程类似的教程侧重于Windows Phone 7,其中有些不同,例如Visual Studio 2012 Ultimate中的Windows应用商店模板没有用于计划任务代理的C#模板C# 使用C语言的Windows8LiveTile后台代理#,c#,windows-8,live-tile,C#,Windows 8,Live Tile,我尝试在Windows 8上每隔一段时间更新一次live互动程序,即使应用程序本身没有运行,我也需要这样做。上列出的通知选项都不合适,我想轮询系统信息,如CPU温度等,这不适合列出的通知样式 我在StackOverflow的其他地方也看到过类似的问题,但WindowsPhone7除外。对我来说,使用背景工作者似乎也是正确的答案。然而,与前一个教程类似的教程侧重于Windows Phone 7,其中有些不同,例如Visual Studio 2012 Ultimate中的Windows应用商店模板没
因此,我的问题是,我们如何为Windows 8应用程序设置后台工作人员,以便在应用程序本身未运行时执行实时磁贴更新 查看白皮书:;在这和你已经学习和研究的瓷砖之间,你应该能够把一些东西结合起来。你可以阅读背景任务;阅读有关TimeTrigger的内容,在operation background任务中完成的方法OnCompleted中,我们可以设置LiveTile
void OnCompleted(BackgroundTaskRegistration sender, BackgroundTaskCompletedEventArgs args)
{
var tile = CreateNotification(String.Format(@"<tile>
<visual>
<binding template=""TileSquareText04"">
<text id=""1"">{0}</text>
<text id=""2""></text>
</binding>
<binding template=""TileSquareText02"">
<text id=""1"">{0}</text>
<text id=""2""></text>
</binding>
</visual>
</tile>", DateTime.Now.ToString("hh:mm:ss")));
TileUpdateManager.CreateTileUpdaterForApplication().Update(tile);
}
private TileNotification CreateNotification(string xml)
{
var xmlDocument = new XmlDocument();
xmlDocument.LoadXml(xml);
return new TileNotification(xmlDocument);
}
void OnCompleted(BackgroundTaskRegistration发件人,BackgroundTaskCompletedEventArgs args args)
{
var tile=CreateNotification(String.Format(@)
{0}
{0}
,DateTime.Now.ToString(“hh:mm:ss”);
TileUpdateManager.CreateTileUpdateForApplication().Update(平铺);
}
私有TileNotification CreateNotification(字符串xml)
{
var xmlDocument=新的xmlDocument();
LoadXml(xml);
返回新的TileNotification(xmlDocument);
}