Toast 通知导航 WinRT

Toast notification navigate WinRT

找资料,没找到。告诉我,如何在单击普通通知时导航到所需的页面。 对如何在关闭和打开应用程序时执行此操作感兴趣。

p.s。我的意思是 ScheduledToastNotification

如果您使用的是 UWP,则需要在 App.xaml.cs 中的 protected override void OnActivated(IActivatedEventArgs args) 方法中处理激活。如果 args.Kind == ActivationKind.ToastNotification 那么 args 的类型是 ToastNotificationActivatedEventArgs.

参见:

由于@Squidward,我找到了你问题的答案。 从上面的文章我去了https://msdn.microsoft.com/ru-ru/library/windows/apps/xaml/hh868212.aspx

在我的代码中,我在参数数据中添加了以下内容和我的 OnLanched 字段。现在我也许可以制定计划了!

        ToastTemplateType _toastTemplate = ToastTemplateType.ToastText02;
        XmlDocument _toastXml = ToastNotificationManager.GetTemplateContent(_toastTemplate);

        //this set argument for OnLaunched
        IXmlNode toastNode = _toastXml.SelectSingleNode("/toast");
        ((XmlElement)toastNode).SetAttribute("launch", "111111");
        //---