【发布时间】:2015-04-30 14:23:18
【问题描述】:
我正在像这样向设备发送 Toast 通知。
private void SendNotification(string text, string activatedargs = null) {
XmlDocument toastXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText01);
XmlNodeList elements = toastXml.GetElementsByTagName("text");
foreach(IXmlNode node in elements) {
node.InnerText = text;
}
if(!string.IsNullOrEmpty(activatedargs)) {
((XmlElement)toastXml.SelectSingleNode("/toast")).SetAttribute("launch", activatedargs);
}
ToastNotification notification = new ToastNotification(toastXml);
notification.Activated += notification_Activated;
ToastNotificationManager.CreateToastNotifier().Show(notification);
}
如您所见,我正在为 Activated 事件添加一个回调函数。当 toast 通知弹出窗口出现在屏幕顶部时,这非常有用。但是当通知消失并且通知仅在操作中心可见时,选择通知时永远不会调用回调。该应用程序可以正常打开,但无法显示基于所选通知的信息视图。
如果我发送了三个 toast 通知,“A”、“B”和“C”。这三个通知列在我的应用名称下方的操作中心中。当专门点击通知“B”时,如何将应用打开到专门与“B”相关的视图?
【问题讨论】:
-
查看此链接:stackoverflow.com/questions/23275723/… 这一定对您有所帮助。
标签: visual-studio windows-phone-8.1