Example #1
0
        protected override void OnSearchActivated(SearchActivatedEventArgs args)
        {
            base.OnSearchActivated(args);
            if (args != null && args.Kind == ActivationKind.Search)
            {
                var searchArgs = args as SearchActivatedEventArgs;

                var start = Mvx.Resolve <IMvxAppStart>();
                if (args.PreviousExecutionState == ApplicationExecutionState.Running)
                {
                    var criteria = new PollsPageSearchNavigationCriteria
                    {
                        SearchQuery = searchArgs.QueryText
                    };
                    start.Start(criteria);
                }
                else
                {
                    var criteria = new LandingPageNavigationCriteria
                    {
                        SearchQuery = searchArgs.QueryText
                    };
                    start.Start(criteria);
                }
            }
        }
Example #2
0
        protected override async void OnSearchActivated(SearchActivatedEventArgs args)
        {
            await EnsureMainPageActivated(args);

            UpdateSearch(args.QueryText);
            SubmitSearch(args.QueryText);
        }
        /// <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;
        }
Example #4
0
        protected override async void OnSearchActivated(SearchActivatedEventArgs args)
        {
            UIElement previousContent = Window.Current.Content;
            var       frame           = previousContent as Frame;

            if (frame == null)
            {
                frame = new Frame();
                SuspensionManager.RegisterFrame(frame, "AppFrame");

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    try
                    {
                        await SuspensionManager.RestoreAsync();
                    }
                    catch (SuspensionManagerException)
                    {
                    }
                }
            }

            frame.Navigate(typeof(SearchView), args.QueryText);
            Window.Current.Content = frame;

            Window.Current.Activate();
        }
Example #5
0
        /// <summary>
        /// Invoked when the application is activated to display search results.
        /// </summary>
        /// <param name="args">Details about the activation request.</param>
        protected async override void OnSearchActivated(SearchActivatedEventArgs args)
        {
            // If the Window isn't already using Frame navigation, insert our own Frame
            var frame = Window.Current.Content as Frame;

            // If the app does not contain a top-level frame, it is possible that this
            // is the initial launch of the app. Typically this method and OnLaunched
            // in App.xaml.cs can call a common method.
            if (frame == null)
            {
                // Create a Frame to act as the navigation context and associate it with
                // a SuspensionManager key
                frame = new Frame();
                SuspensionManager.RegisterFrame(frame, "AppFrame");

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // Restore the saved session state only when appropriate
                    try
                    {
                        await SuspensionManager.RestoreAsync();
                    }
                    catch (SuspensionManagerException)
                    {
                        //Something went wrong restoring state.
                        //Assume there is no state and continue
                    }
                }
            }

            NavigatetToSearchPage(frame, args.QueryText);
        }
Example #6
0
        protected async override void OnSearchActivated(SearchActivatedEventArgs args)
        {
            if (args.PreviousExecutionState == ApplicationExecutionState.NotRunning ||
                args.PreviousExecutionState == ApplicationExecutionState.ClosedByUser ||
                args.PreviousExecutionState == ApplicationExecutionState.Terminated)
            {
                var rootFrame = new Frame();
                SuspensionManager.RegisterFrame(rootFrame, "AppFrame");
                Window.Current.Content = rootFrame;
            }

            var previousContent = Window.Current.Content;
            var frame           = previousContent as Frame;

            if (frame == null)
            {
                frame = new Frame();
                SuspensionManager.RegisterFrame(frame, "AppFrame");

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    try
                    {
                        await SuspensionManager.RestoreAsync();
                    }
                    catch (SuspensionManagerException)
                    {
                    }
                }
            }

            frame.Navigate(typeof(ClassListPage), args.QueryText);
            Window.Current.Content = frame;
            Window.Current.Activate();
        }
Example #7
0
        protected override async void OnSearchActivated(SearchActivatedEventArgs e)
        {
            Platform.Current.Analytics.Event("App - OnSearchActivated - LaunchKind: {0}", e.Kind.ToString());
            await this.InitializeAsync(e);

            base.OnSearchActivated(e);
        }
Example #8
0
        protected override void OnSearchActivated(SearchActivatedEventArgs args)
        {
            SplashScreen splashScreen = args.SplashScreen;
            Splash       eSplash      = new Splash(splashScreen, args);

            Window.Current.Activate();
        }
Example #9
0
        async protected override void OnSearchActivated(SearchActivatedEventArgs args)
        {
            base.OnSearchActivated(args);
            await EnsureSplitPageAsync(args);

            ((SplitPage)Window.Current.Content).Search(args.QueryText);
        }
Example #10
0
        protected override async void OnSearchActivated(SearchActivatedEventArgs e)
        {
            PlatformBase.CurrentCore.Analytics.Event("App.OnSearchActivated", this.ToDictionary(e));
            await this.InitializeAsync(e);

            base.OnSearchActivated(e);
        }
Example #11
0
        protected async override void OnSearchActivated(SearchActivatedEventArgs args)
        {
            // OnSearchActivated is called in lieu of OnLaunched if the operating system launches the app from the search pane

            if (args.PreviousExecutionState == ApplicationExecutionState.NotRunning ||
                args.PreviousExecutionState == ApplicationExecutionState.ClosedByUser ||
                args.PreviousExecutionState == ApplicationExecutionState.Terminated)
            {
                // The app was launched by the user initiating a search
                var rootFrame = new Frame();

                SuspensionManager.RegisterFrame(rootFrame, "AppFrame");
                Window.Current.Content = rootFrame;

                try
                {
                    // Create a background image to be used on all pages
                    rootFrame.Background = new ImageBrush
                    {
                        ImageSource = new BitmapImage(new Uri("ms-appx:///Assets/AppBackground.png")),
                        Stretch     = Stretch.UniformToFill
                    };
                }
                catch
                {
                    // Quietly ignore this error for setting the background image
                }

                // Make sure any search starts from the root folder
                ApplicationData.Current.RoamingSettings.Values["CurrentSnippetPath"] = RootSnippetPath;

                // Register handler for CommandsRequested events from the settings charm (for the About box)
                SettingsPane.GetForCurrentView().CommandsRequested += OnCommandsRequested;
            }

            var previousContent = Window.Current.Content;
            var frame           = previousContent as Frame;

            if (frame == null)
            {
                frame = new Frame();
                SuspensionManager.RegisterFrame(frame, "AppFrame");

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    try
                    {
                        await SuspensionManager.RestoreAsync();
                    }
                    catch (SuspensionManagerException)
                    {
                    }
                }
            }

            frame.Navigate(typeof(HomePage), args.QueryText);
            Window.Current.Content = frame;
            Window.Current.Activate();
        }
Example #12
0
        protected override async void OnSearchActivated(SearchActivatedEventArgs args)
        {
            // TODO: Add "Search" in the "Declarations" section of Package.appxmanifest
            await InitializeFrameAsync(args.PreviousExecutionState);

            // TODO: Implement this directly in App.xaml.cs
            SearchSamplePage.OnSearchActivated(args);
        }
Example #13
0
        protected override async void OnSearchActivated(SearchActivatedEventArgs args)
        {
            await ActivateApplication(args);

            if (args.QueryText != "")
            {
                await((Window.Current.Content as Frame).Content as MainPage).SearchFor(args.QueryText);
            }
        }
Example #14
0
 protected override void OnSearchActivated(SearchActivatedEventArgs args)
 {
     if (!settings)
     {
         SettingsPane.GetForCurrentView().CommandsRequested += OnCommandsRequested;
         settings = true;
     }
     // Activate immediately if data is available
     //Think.WinStore.SearchResultsPage.Activate(args.QueryText, args.PreviousExecutionState);
 }
Example #15
0
        protected override void OnSearchActivated(SearchActivatedEventArgs args)
        {
            base.OnSearchActivated(args);

            var searchResultsPage = new SearchResultsPage();

            ((SearchResultsViewModel)searchResultsPage.DataContext).PerformSearchAsync(args.QueryText);

            WindowManager.NavigateTo(searchResultsPage);
        }
Example #16
0
        /// <summary>
        ///     Enable search contract
        /// </summary>
        /// <param name="args">Contains search query</param>
        protected override void OnSearchActivated(SearchActivatedEventArgs args)
        {
            base.OnSearchActivated(args);

            SettingsPane.GetForCurrentView().CommandsRequested += OnSettingPane_Opening;

            Frame frame = CreateOrGetCurrentFrame();

            frame.Navigate(typeof(SearchPage), args.QueryText);
        }
Example #17
0
        private System.Collections.Generic.Dictionary <string, string> ToDictionary(SearchActivatedEventArgs e)
        {
            var dic = new System.Collections.Generic.Dictionary <string, string>();

            dic.Add("Kind", e.Kind.ToString());
            dic.Add("QueryText", e.QueryText);
            dic.Add("Language", e.Language);
            dic.Add("PreviousExecutionState", e.PreviousExecutionState.ToString());
            return(dic);
        }
Example #18
0
        protected override void OnSearchActivated(SearchActivatedEventArgs args)
        {
            var frame = Window.Current.Content as Frame;

            if (frame == null)
            {
                StartApplication();
            }

            _shellViewModel.SendSearchQueryMessage(args.QueryText);
        }
Example #19
0
 /// <summary>
 /// This is the handler for Search activation.
 /// </summary>
 /// <param name="args">This is the list of arguments for
 /// search activation, including QueryText and Language</param>
 protected override void OnSearchActivated(SearchActivatedEventArgs args)
 {
     this.EnsureMainPageActivated(args, null);
     if (args.QueryText != "")
     {
         // display search results.
         Frame rootFrame = Window.Current.Content as Frame;
         rootFrame.Navigate(typeof(MainPage));
         MainPage.Current.RefreshGridWithSearchResults(args.QueryText);
     }
 }
Example #20
0
 /// <summary>
 /// This is the handler for Search activation.
 /// </summary>
 /// <param name="args">This is the list of arguments for search activation, including QueryText and Language</param>
 protected override void OnSearchActivated(SearchActivatedEventArgs args)
 {
     if (string.IsNullOrEmpty(args.QueryText))
     {
         // navigate to landing page.
     }
     else
     {
         // display search results.
         RootFrame.Navigate(typeof(ShowListPage), new ShowListParams(MethodCall.Search, null, args.QueryText));
     }
 }
Example #21
0
        protected override sealed async void OnSearchActivated(SearchActivatedEventArgs args)
        {
            await this.HandleWaitForConstructedActionsAsync();

            AppStartInfo info = AppStartInfo.Default;

            await this.OnPreStartAsync(args, info);

            await this.OnSearchStartAsync(args, info);

            this.InternalStartAsync(args, info);
        }
 async protected override void OnSearchActivated(SearchActivatedEventArgs args)
 {
     //await EnsureMainPageActivatedAsync(args);
     if (args.QueryText == "")
     {
         // navigate to landing page.
     }
     else
     {
         // display search results.
         MainPage.Current.ShowQueryText(args.QueryText);
     }
 }
Example #23
0
        protected override void OnSearchActivated(SearchActivatedEventArgs args)
        {
            base.OnSearchActivated(args);

            var view      = new SearchView();
            var viewModel = new SearchViewModel();

            viewModel.SearchText = args.QueryText;
            view.DataContext     = viewModel;

            Window.Current.Content = view;
            Window.Current.Activate();
        }
Example #24
0
        /// <summary>
        /// Invoked when the application is activated to display search results.
        /// </summary>
        /// <param name="args">Details about the activation request.</param>
        protected override void OnSearchActivated(SearchActivatedEventArgs args)
        {
            if (Extended)
            {
                SearchResultsPage.Activate(args);
            }
            else
            {
                ExtendedSplash(args.SplashScreen, args);
            }

            RegisterSettings();
        }
Example #25
0
        async protected override void OnSearchActivated(SearchActivatedEventArgs args)
        {
            ObservableCollection <WeatherReport> queryResult = new ObservableCollection <WeatherReport>();

            if (args.QueryText.StartsWith("sol: "))
            {
                int sol, startIndex = args.QueryText.IndexOf(' ');
                if (int.TryParse(args.QueryText.Substring(args.QueryText.IndexOf(' '), args.QueryText.Length - startIndex), out sol))
                {
                    foreach (var item in viewModel.QueriedList)
                    {
                        if (item.Sol == sol)
                        {
                            queryResult.Add(item);
                            viewModel.QueriedList = queryResult;
                            return;
                        }
                    }
                }
            }
            else if (args.QueryText.Contains(" - "))
            {
                string[] dates      = args.QueryText.Split(new char[] { ' ', '-', ' ' });
                DateTime firstDate  = new DateTime();
                DateTime secondDate = new DateTime();
                if (!DateTime.TryParse(dates[0], out firstDate) || !DateTime.TryParse(dates[3], out secondDate))
                {
                    return;
                }
                if (firstDate >= secondDate)
                {
                    return;
                }

                foreach (var item in viewModel.QueriedList)
                {
                    if (item.MeasuredDate >= firstDate && item.MeasuredDate <= secondDate)
                    {
                        queryResult.Add(item);
                    }
                }
                viewModel.QueriedList = queryResult;
            }
            else if (args.QueryText == "reset")
            {
                viewModel.LoadReportInListView();
                viewModel.QueriedList.Clear();
                // display search results.
            }
        }
Example #26
0
        /// <summary>
        /// Invoked when the application is activated through a search association.
        /// </summary>
        /// <param name="args">Event data for the event.</param>
        // Documentation on using search is at http://go.microsoft.com/fwlink/?LinkID=288822&clcid=0x409
        protected async override void OnSearchActivated(SearchActivatedEventArgs args)
        {
            // If the Window isn't already using Frame navigation, insert our own Frame
            var rootFrame = await InitializeFrameAsync(args);

            if (rootFrame != null)
            {
                var searchQueryArguments = new SearchQueryArguments(args);
                OnSearchApplication(searchQueryArguments);
            }

            // Ensure the current window is active
            Window.Current.Activate();
        }
Example #27
0
        protected override void OnSearchActivated(SearchActivatedEventArgs args)
        {
            base.OnSearchActivated(args);
            var previousContent = Window.Current.Content;
            var frame           = previousContent as Frame ?? new Frame();

            Dispatcher = Window.Current.Dispatcher;
            AppBase.Current.SearchTerm = args.QueryText;
            frame.Navigate(typeof(Views.SearchResult), args.QueryText);
            Window.Current.Content = frame;

            // Ensure the current window is active
            Window.Current.Activate();
        }
Example #28
0
        /// <summary>
        /// This is the handler for Search activation.
        /// </summary>
        /// <param name="args">This is the list of arguments for search activation, including QueryText and Language</param>
        async protected override void OnSearchActivated(SearchActivatedEventArgs args)
        {
            await EnsureMainPageActivatedAsync(args);

            if (args.QueryText == "")
            {
                // navigate to landing page.
            }
            else
            {
                // display search results.
                (Window.Current.Content as Frame).Navigate(typeof(ItemsPage), args.QueryText);
            }
        }
 protected override void OnSearchActivated(SearchActivatedEventArgs args)
 {
     // await EnsureMainPageActivatedAsync(args);
     //var rootFrame = new Frame(); ;
     //if (args.QueryText == "")
     //{
     //    rootFrame.Navigate(typeof(GroupedItemsPage), "Root");
     //}
     //else
     //{
     //    rootFrame.Navigate(typeof(SearchResultsPage), args.QueryText);
     //}
     //Window.Current.Content = rootFrame;
     //Window.Current.Activate();
 }
Example #30
0
        async protected override void OnSearchActivated(SearchActivatedEventArgs args)
        {
            base.OnSearchActivated(args);

            //Set language
            DetectDutchLanguage();

            EnsureMainPageAsync(args);
            //((MainPage)Window.Current.Content).Test(args.QueryText);

            RegisterForSettings();

            RegisterForSearch();

            await SearchStations(args.QueryText);
        }
        protected override void OnSearchActivated( SearchActivatedEventArgs args )
        {
            Contract.Assume( args != null );

            IServiceProvider serviceProvider = Host;

            if ( serviceProvider == null )
                return;

            IEventBroker eventBroker;

            // publish search event for the entire application
            if ( !serviceProvider.TryGetService( out eventBroker ) )
                return;

            var e = new SearchEventArgs( args.Language, args.QueryText );
            eventBroker.Publish( "Search", null, e );
        }