Raising a toast in a prism service with launch params

Oct 1, 2013 at 3:29 AM
Hi all

Trying to raise a toast in a prism service using the following code
var xml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText01);
var launchAttribute = xml.CreateAttribute("launch");
launchAttribute.Value = "1234";
xml.GetElementsByTagName("text")[0].InnerText = "Value";
ToastNotification toast = new ToastNotification(xml);
But when I click on the Toast the launch event seems to get eaten by Prism.
Any ideas?
Oct 1, 2013 at 8:58 PM

I just tested the code snippet you are using to create the Toast Notification and it seems to be working correctly.
When the Toast is clicked the application enters the OnLaunched method of the MvvmAppBase class with the corresponding parameters. However, due to the conditions in the aforementioned method, the OnLaunchApplication method of the App class doesn't get invoked.

A possible solution could be to override the OnLaunched method so that it can handle the scenario of the application being launched by a Notification Toast, for example, by invoked another method. For this you could also add a launch parameter to the Toast so that the application can identify that it's being launched from a notification.


Damian Cherubini