在Win 8 Metro应用程序中更新图块 [英] updating tiles in Win 8 Metro app

查看:72
本文介绍了在Win 8 Metro应用程序中更新图块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,在我的Metro应用程序中,我已经在appxmainfest文件中设置了宽徽标,然后在按钮上的页面中单击,我已经编写了此代码

Hi in my metro app i have set the wide logo in appxmainfest file and then in page on button click i have written this code

XmlDocument tileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWideText03);
var textElement = tileXml.GetElementsByTagName("text")[0].AppendChild(tileXml.CreateTextNode("Hey This my Text Updated on Tile"));
var tn = new TileNotification(tileXml);
TileUpdateManager.CreateTileUpdaterForApplication().Update(tn);

但在最后一行却给了我错误.

but at the last line it give me error.

提供的应用程序标识符无效. 在Windows.UI.Notifications.TileUpdateManager.CreateTileUpdaterForApplication() 在TilesCS.ScenarioInput1.UpdateTileWithText_Click(Object sender,RoutedEventArgs e)中位于c:\ Users \ nitin \ Downloads \ App tile和徽章sample \ C#\ ScenarioInput1.xaml.cs:line 68

The application identifier provided is invalid. at Windows.UI.Notifications.TileUpdateManager.CreateTileUpdaterForApplication() at TilesCS.ScenarioInput1.UpdateTileWithText_Click(Object sender, RoutedEventArgs e) in c:\Users\nitin\Downloads\App tiles and badges sample\C#\ScenarioInput1.xaml.cs:line 68

我尝试了Microsoft提供的示例应用程序,但是它也存在相同的问题.我搜索了其他示例应用程序和代码,但是我尝试过的所有操作都给出了错误.

I tried the sample app by Microsoft but it also has the same issue. I searched other sample app and code but what ever I tried they all gives error.

在一篇文章中,我读到我需要将tile的某些属性设置为dynamic,但是我无法在任何地方对其进行优化.有谁知道我哪里错了.

In one article I read that I need to set some attribute of tile to dynamic but I cant fine it anywhere. Does any one know where I am wrong.

推荐答案

就解决了.我在模拟器中运行它会给出错误.但是,如果我们在localmachine中运行该应用程序,那么它就可以了.因此,在更新图块时,应在本地计算机上而不是模拟器上运行该应用程序

Just solved it. I was running it in simulator where it will give error. But if we run the app in localmachine then it wors fine. So run the app on local machine and not on simulator when working on updating tiles

这篇关于在Win 8 Metro应用程序中更新图块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆