/// <summary> /// Determines how best to support navigation back to the previous application state. /// </summary> public static void Activate(SearchActivatedEventArgs args) { 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), args.QueryText); } else { // Otherwise bypass navigation and provide the tools needed to emulate the back stack var page = new SearchResultsPage { _previousContent = previousContent }; page.LoadState(args.QueryText, null); Window.Current.Content = page; } // Either way, active the window Window.Current.Activate(); App.Instance.Share = null; }