protected async override void OnNavigatedTo(NavigationEventArgs e) { var criteria = (NavigationPageCriteria)e.Parameter; if (criteria != null) { NavigationPageCriteria = criteria; } }
protected override void OnActivated(IActivatedEventArgs e) { // Get the root frame Frame rootFrame = Window.Current.Content as Frame; // TODO: Initialize root frame just like in OnLaunched // Handle toast activation if (e is ToastNotificationActivatedEventArgs) { var toastActivationArgs = e as ToastNotificationActivatedEventArgs; // Parse the query string QueryString args = QueryString.Parse(toastActivationArgs.Argument); // See what action is being requested switch (args["action"]) { // Open the image case "chat": int chatId = int.Parse(args["chatId"]); if (rootFrame.Content is Pages.ChatDetail && (rootFrame.Content as Pages.ChatDetail).ChatObject.Id.Equals(chatId)) break; //// Otherwise navigate to view it var criteria = new NavigationPageCriteria { Action = "ChatDetail", Id = chatId }; rootFrame.Navigate(typeof(MainPage), criteria); break; // Open the conversation case "checkin": //// The conversation ID retrieved from the toast args //int conversationId = int.Parse(args["conversationId"]); //// If we're already viewing that conversation, do nothing //if (rootFrame.Content is ConversationPage && (rootFrame.Content as ConversationPage).ConversationId == conversationId) // break; //// Otherwise navigate to view it //rootFrame.Navigate(typeof(ConversationPage), conversationId); break; } // If we're loading the app for the first time, place the main page on // the back stack so that user can go back after they've been // navigated to the specific page if (rootFrame.BackStack.Count == 0) rootFrame.BackStack.Add(new PageStackEntry(typeof(MainPage), null, null)); } // TODO: Handle other types of activation // Ensure the current window is active Window.Current.Activate(); }