windows 8应用程序中的toast通知不起作用

本文关键字:toast 通知 不起作用 应用程序 windows | 更新日期: 2023-09-27 18:22:25

我在我的Package.appxmanifest中保留了toast Capable="true",即使它没有显示toast通知,示例应用程序也可以从这里下载

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

windows 8应用程序中的toast通知不起作用

Toast仅在本地机器中工作,不在刺激器中工作