Итак, я использую новый ToastNotificationManager в своем проекте 8.1 SL вместо старого ShellToast. ShellToast содержал NavigationUri во всплывающем сообщении, что делало его действительно простым.
В новых тостах необходимо самостоятельно указать параметры запуска согласно эту статью. Однако похоже, что в 8.1 SL нет события OnLaunched(LaunchActivatedEventArgs args), которое вы должны прослушивать в App.xaml.cs для параметров:
Шаг 2. Обработайте событие приложения OnLaunched.
Когда пользователь нажимает на всплывающее уведомление или выбирает его касанием, соответствующее приложение запускается, вызывая событие OnLaunched.
Примечание. Если вы не включили строку атрибута запуска в всплывающее уведомление и ваше приложение уже запущено, когда всплывающее уведомление выбрано, событие OnLaunched не запускается.
В этом примере показан синтаксис для переопределения события OnLaunched, в котором вы будете получать строку запуска, предоставленную во всплывающем уведомлении, и действовать в соответствии с ней.
protected override void OnLaunched(LaunchActivatedEventArgs args)
{
string launchString = args.Arguments
....
}
Мой код:
// Using the ToastText02 toast template.
ToastTemplateType toastTemplate = ToastTemplateType.ToastText02;
// Retrieve the content part of the toast so we can change the text.
XmlDocument toastXml = ToastNotificationManager.GetTemplateContent(toastTemplate);
//Find the text component of the content
XmlNodeList toastTextElements = toastXml.GetElementsByTagName("text");
// Set the text on the toast.
// The first line of text in the ToastText02 template is treated as header text, and will be bold.
toastTextElements[0].AppendChild(toastXml.CreateTextNode("Heading"));
toastTextElements[1].AppendChild(toastXml.CreateTextNode("Body"));
// Set the duration on the toast
IXmlNode toastNode = toastXml.SelectSingleNode("/toast");
((XmlElement)toastNode).SetAttribute("duration", "long");
//Launch params
string paramString = "{\"type\":\"toast\",\"param1\":\"12345\"}";
((XmlElement)toastXml.SelectSingleNode("/toast")).SetAttribute("launch", paramString);
// Create the actual toast object using this toast specification.
ToastNotification toast = new ToastNotification(toastXml);
// Set SuppressPopup = true on the toast in order to send it directly to action center without
// producing a popup on the user's phone.
toast.SuppressPopup = true;
// Send the toast.
ToastNotificationManager.CreateToastNotifier().Show(toast);
Кто-нибудь знает, как это решить? Спасибо