Example #1
0
        // *** Methods ***

        public async Task <bool> Activate(IActivatedEventArgs activatedEventArgs)
        {
            if (activatedEventArgs.Kind == ActivationKind.Search && !string.IsNullOrEmpty(SearchPageName))
            {
                ISearchActivatedEventArgs searchEventArgs = (ISearchActivatedEventArgs)activatedEventArgs;

                // If the previous execution state was terminated then attempt to restore the navigation stack

                if (activatedEventArgs.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    await navigationManager.RestoreNavigationStack();
                }

                // Otherwise if the application is a new instance navigate to the home page

                else if (activatedEventArgs.PreviousExecutionState == ApplicationExecutionState.ClosedByUser ||
                         activatedEventArgs.PreviousExecutionState == ApplicationExecutionState.NotRunning)
                {
                    navigationManager.NavigateTo(navigationManager.HomePageName);
                }

                // Then display the search results

                DisplaySearchResults(searchEventArgs.QueryText, searchEventArgs.Language);

                return(true);
            }

            return(false);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="SearchQueryArguments"/> class using an instance that implements the ISearchActivatedEventArgs interface.
 /// </summary>
 /// <param name="args">The <see cref="ISearchActivatedEventArgs"/> instance containing the event data, that will be used for initializing the SearchQueryArgument instance.</param>
 public SearchQueryArguments(ISearchActivatedEventArgs args)
 {
     if (args != null)
     {
         Language = args.Language;
         QueryText = args.QueryText;
     }
 }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SearchQueryArguments"/> class using an instance that implements the ISearchActivatedEventArgs interface.
 /// </summary>
 /// <param name="args">The <see cref="ISearchActivatedEventArgs"/> instance containing the event data, that will be used for initializing the SearchQueryArgument instance.</param>
 public SearchQueryArguments(ISearchActivatedEventArgs args)
 {
     if (args != null)
     {
         Language  = args.Language;
         QueryText = args.QueryText;
     }
 }