window8.1无法在toast通知上使用webbase image url [英] window8.1 can't use webbase image url on toast notification

查看:52
本文介绍了window8.1无法在toast通知上使用webbase image url的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

window8.1无法在toast通知上使用webbase image url

window8.1 can't use webbase image url on toast notification

XmlDocument toastXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastImageAndText02);

// Fill in the text elements
XmlNodeList stringElements = toastXml.GetElementsByTagName("text");
stringElements[0].AppendChild(toastXml.CreateTextNode("Mytitle"));
stringElements[1].AppendChild(toastXml.CreateTextNode("Mybody"));

// Specify the absolute path to an image
XmlNodeList imageElements = toastXml.GetElementsByTagName("image");

//---Toast show normal---
imageElements[0].Attributes.GetNamedItem("src").NodeValue = @"file:///" + Path.GetFullPath("toastImageAndText.png");

//---Toast not show---	Why???
imageElements[0].Attributes.GetNamedItem("src").NodeValue = @"http://images5.fanpop.com/image/photos/31300000/beautiful-heart-pic-beautiful-pictures-31395948-333-500.jpg";
          
ToastNotification toast = new ToastNotification(toastXml);
ToastNotificationManager.CreateToastNotifier("APP_ID").Show(toast);




推荐答案

嗨SomjetSomjet,

Hi SomjetSomjet,

感谢您在此发帖。

据我所知,如果您想显示包含图片的Toast通知。 必须从XML中提供图像信息。

As far as I know that if you want to display a toast notification that includes image.  the information of image must be given from the XML.

所以我认为信息存储在XML文档中,这主要是因为。

So I think that the information stores in XML document, which is mainly reason.

当您使用代码时:

XmlNodeList imageElements = toastXml.GetElementsByTagName("image");

该方法将从XML文档对象中指定Toast所需的元素。

The method will specify the required elements for toast from the XML document object.

现在你通过使用图像的绝对路径直接指定路径,我认为编译器无法查看它。

Now you specify the path directly by using absolute path for image, I think that the compiler cannot look out it.

和getTemplateContent方法返回包含Toast通知XML内容的Windows.Data.Xml.Dom.XmlDocument对象

and the getTemplateContent method returns a Windows.Data.Xml.Dom.XmlDocument object that contains the toast notification XML content.

最诚挚的问候,

Hart


这篇关于window8.1无法在toast通知上使用webbase image url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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