平铺通知在Windows 8.1中不起作用 [英] Tile notification not working in windows 8.1

查看:102
本文介绍了平铺通知在Windows 8.1中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用此代码向我的应用程序发送本地磁贴通知

 XmlDocument tileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWide310x150ImageAndText01); 
XmlNodeList tileTextAttributes = tileXml.GetElementsByTagName(" text");
tileTextAttributes [0] .InnerText =" Test text" ;;
XmlNodeList tileImageAttributes = tileXml.GetElementsByTagName(" image");
((XmlElement)tileImageAttributes [0])。SetAttribute(" src"," http://zetice.com/picture.png");

TileNotification tileNotification = new TileNotification(tileXml);
// tileNotification.ExpirationTime = DateTimeOffset.UtcNow.AddDays(1);
tileNotification.Tag =" TestTag" ;;
TileUpdateManager.CreateTileUpdaterForApplication()。更新(tileNotification);

但是这段代码什么也没做。当我看到应用程序磁贴时,我看不到任何变化。是的我启用了通知。


奇怪的是,吐司通知有效。它只是瓦片通知不起作用。有谁知道问题是什么?


解决方案

我没有看到图像 http://zetice.com/picture.png  。你有正确的URL吗?除此之外,您的代码看起来非常正确。请参阅

Quickstart :为类似示例发送磁贴更新


您还只设置了宽磁贴,因此如果用户有一个正方形,则不会显示。


对于辅助功能,您应该始终在图像上设置alt标记,但我认为您只是为了示例而将其保留。


- 罗布


I used this code to send a local tile notification to my app

            XmlDocument tileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWide310x150ImageAndText01);
            XmlNodeList tileTextAttributes = tileXml.GetElementsByTagName("text");
            tileTextAttributes[0].InnerText = "Test text";
            XmlNodeList tileImageAttributes = tileXml.GetElementsByTagName("image");
            ((XmlElement)tileImageAttributes[0]).SetAttribute("src", "http://zetice.com/picture.png");

            TileNotification tileNotification = new TileNotification(tileXml);
            //    tileNotification.ExpirationTime = DateTimeOffset.UtcNow.AddDays(1);
            tileNotification.Tag = "TestTag";
            TileUpdateManager.CreateTileUpdaterForApplication().Update(tileNotification);

But this code does nothing. When i look at the app tile, i see no change. Yes i have notifications enabled.

Weird thing is that, toast notifiction works. It's just tile notifications that doesnt work. Anyone know what the problem is?

解决方案

I don't see an image at http://zetice.com/picture.png . Do you have the right URL? Other than that your code looks superficially correct. See Quickstart: Sending a tile update for a similar example.

You're also setting just the wide tile, so if the user has a square one set this won't show up.

For accessibility you should always set the alt tag on your image, but I assume that you left that out just for the example's sake.

--Rob


这篇关于平铺通知在Windows 8.1中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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