2

我在我的 Package.appxmanifest 中保留了 ToastCapable="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

4

1 回答 1

2

Toast 仅适用于本地机器,不适用于 Stimulator

于 2013-07-17T04:55:31.433 回答