2
我在Package.appxmanifest保持ToastCapable =「真」即使這樣,它不顯示Toast通知示例應用程序可以從這裏toastnotification在Windows 8的應用程序無法正常工作
https://docs.google.com/file/d/0B75nbNO58O7dQzM2bTloR0pia00/edit
try
{
var notificationxml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText01);
var toastele = notificationxml.GetElementsByTagName("text");
toastele[0].AppendChild(notificationxml.CreateTextNode("this"));
var toastnote = new ToastNotification(notificationxml);
ToastNotificationManager.CreateToastNotifier().Show(toastnote);
ToastTemplateType toastType = ToastTemplateType.ToastImageAndText02;
XmlDocument toastXML = ToastNotificationManager.GetTemplateContent(toastType);
XmlNodeList toastText = toastXML.GetElementsByTagName("text");
XmlNodeList toastImages = toastXML.GetElementsByTagName("image");
toastText[0].InnerText = "Funny cat";
toastText[1].InnerText = "This cat looks like it's trying to eat your face.";
((XmlElement)toastImages[0]).SetAttribute("src", "ms-appx:///Assets/10-XAML-CatImageSmall.png");
((XmlElement)toastImages[0]).SetAttribute("alt", "Scary Cat Face");
ToastNotification toast = new ToastNotification(toastXML);
ToastNotificationManager.CreateToastNotifier().Show(toast);
}
catch (Exception msg)
{
//userprogress.Visibility = Visibility.Collapsed;
string er = msg.ToString();
var s = msg.Message;
}
下載請幫我
代碼下載:https://docs.google.com/file/d/0B75nbNO58O7dQzM2bTloR0pia00/edit
吐司只能在本地計算機沒有刺激 http://stackoverflow.com/questions/12738428/toast-notification-isnt-working/12738539#12738539 – jghjhj