【发布时间】:2015-08-04 11:22:02
【问题描述】:
我正在使用以下代码为 Windows phone 8.1 应用程序实现 toast 通知。我必须将默认声音更改为 Assets 文件夹中的声音。谁能帮帮我?
ToastTemplateType toastType = ToastTemplateType.ToastText02;
XmlDocument toastXml = ToastNotificationManager.GetTemplateContent(toastType);
XmlNodeList toastTextElement = toastXml.GetElementsByTagName("text");
toastTextElement[0].AppendChild(toastXml.CreateTextNode("WeCare says: "));
toastTextElement[1].AppendChild(toastXml.CreateTextNode(initialTime + " seconds left"));
IXmlNode toastNode = toastXml.SelectSingleNode("/toast");
XmlElement audio = toastXml.CreateElement("audio");
// audio.SetAttribute("src", "/Assets/N.mp3");
((XmlElement)toastNode).SetAttribute("duration", "long");
//((XmlElement)toastNode).SetAttribute("loop", "true");
ToastNotification toast = new ToastNotification(toastXml);
ToastNotificationManager.CreateToastNotifier().Show(toast);
【问题讨论】:
标签: c# windows-phone-8.1