/// <summary> /// Determines how best to support navigation back to the previous application state. /// </summary> public static void Activate(String queryText, ApplicationExecutionState previousExecutionState) { var previousContent = Window.Current.Content; var frame = previousContent as Frame; if (frame != null) { // If the app is already running and uses top-level frame navigation we can just // navigate to the search results frame.Navigate(typeof(SearchResultsPage), queryText); } else { // Otherwise bypass navigation and provide the tools needed to emulate the back stack SearchResultsPage page = new SearchResultsPage(); page._previousContent = previousContent; page._previousExecutionState = previousExecutionState; page.LoadState(queryText, null); Window.Current.Content = page; } // Either way, active the window Window.Current.Activate(); }