I have a windows UWP app written with MVVPCross. The application method OnActivated is called when the user clicks on a Toast Notifcation message.
protected override void OnActivated(IActivatedEventArgs e)
{
// Handle toast activation
if (e is ToastNotificationActivatedEventArgs)
{
var toastActivationArgs = e as ToastNotificationActivatedEventArgs;
}
}
When I get this event it want to:
I'm looking for guidance how I can force a navigation via the mvvmcross framework. I know how to navigate from one view model to another but in this case, I'm not in the context of a view or a view model - i'm in the context of the Windows.UI.Xaml.Application object.
thanks, michael
I think the only thing you need is instance of current frame
if (args.Kind == ActivationKind.ToastNotification)
{
try
{
if (args.PreviousExecutionState == ApplicationExecutionState.Running)
{
var fr = Window.Current.Content as Frame;
var toastActivationArgs = args as ToastNotificationActivatedEventArgs;
fr.Navigate(typeof(MainPage), toastActivationArgs);
}
}
catch { }
}
In your MainPage OnNavigatedTo action you can get Navigation parameters and do whatever you want .