我正在关注几个例子,当我点击我应用程序中的一个按钮时发出敬酒通知。 我采取了以下示例:http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh868254.aspxToast通知不起作用?
我没有收到任何错误,但是当我运行应用程序时,我没有收到吐司通知。 我创建了一个片段在这里:http://codepaste.net/btkzeg
ToastTemplateType toastTemplate = ToastTemplateType.ToastImageAndText01;
XmlDocument toastXml = ToastNotificationManager.GetTemplateContent(toastTemplate);
XmlNodeList toastTextElements = toastXml.GetElementsByTagName("text");
toastTextElements[0].AppendChild(toastXml.CreateTextNode("Hello World!"));
XmlNodeList toastImageAttributes = toastXml.GetElementsByTagName("image");
((XmlElement)toastImageAttributes[0]).SetAttribute("src", "ms-appx:///assets/oil.png");
((XmlElement)toastImageAttributes[0]).SetAttribute("alt", "oil graphic");
IXmlNode toastNode = toastXml.SelectSingleNode("/toast");
((XmlElement)toastNode).SetAttribute("duration", "long");
((XmlElement)toastNode).SetAttribute("launch", "{\"type\":\"toast\",\"param1\":\"12345\",\"param2\":\"67890\"}");
ToastNotification toast = new ToastNotification(toastXml);
ToastNotificationManager.CreateToastNotifier().Show(toast);
如果您有任何建议,请让我知道。
[Toast Notification not working]的可能重复(http://stackoverflow.com/questions/9107177/toast-notification-not-working) – bummi