gpt4 book ai didi

c# - Windows 8 应用程序中的 toastnotification 无法正常工作

转载 作者:太空宇宙 更新时间:2023-11-03 11:01:12 26 4
gpt4 key购买 nike

我在我的 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

最佳答案

Toast 仅适用于本地计算机,不适用于 Stimulator

关于c# - Windows 8 应用程序中的 toastnotification 无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17674204/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com