If your app is already open when the toast notification is received, the following event handler can get the parameters of the notification (for example e.Collection[wp:Text1]
will return the title of the toast) :
void PushChannel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
{
StringBuilder message = new StringBuilder();
string relativeUri = string.Empty;
message.AppendFormat("Received Toast {0}:\n", DateTime.Now.ToShortTimeString());
// Parse out the information that was part of the message.
foreach (string key in e.Collection.Keys)
{
message.AppendFormat("{0}: {1}\n", key, e.Collection[key]);
if (string.Compare(
key,
"wp:Param",
System.Globalization.CultureInfo.InvariantCulture,
System.Globalization.CompareOptions.IgnoreCase) == 0)
{
relativeUri = e.Collection[key];
}
}
// Display a dialog of all the fields in the toast.
Dispatcher.BeginInvoke(() => MessageBox.Show(message.ToString()));
}
If your app is opened by clicking the toast notification, you can implement the following method in the page where your app is opened. You can access the parameters passed in the query string of the wp:Param
parameter of the toast notification. I'm not sure how to get Text1 and Text2 in this method.
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
base.OnNavigatedTo(e);
// If we navigated to this page
// from the MainPage, the DefaultTitle parameter will be "FromMain". If we navigated here
// when the secondary Tile was tapped, the parameter will be "FromTile".
textBlockFrom.Text = "Navigated here from " + this.NavigationContext.QueryString["NavigatedFrom"];
}
Code samples were taken from here.