/// <summary>
        /// Place Splash Screen at the center of the page and register to the following events:
        /// DataTransferManager -> DataRequested
        /// SearchPane -> SuggestionsRequested, SearchPaneQuerySubmitted
        /// SettingsPane -> CommandsRequested
        /// NotesDataSource -> DataCompleted
        /// </summary>
        /// <param name="splashScreen">SplashScreen from IActivatedEventArgs</param>
        async private void Init(SplashScreen splashScreen)
        {
            if (!NotesDataSource.DataLoaded)
            {
                this.InitializeComponent();
                this.splashImageCoordinates = splashScreen.ImageLocation;
                this.splash = splashScreen;

                // Position the extended splash screen image in the same location as the splash screen image.
                this.loader.SetValue(Canvas.LeftProperty, this.splashImageCoordinates.X);
                this.loader.SetValue(Canvas.TopProperty, this.splashImageCoordinates.Y);
                this.loader.Height = this.splashImageCoordinates.Height;
                this.loader.Width  = this.splashImageCoordinates.Width;

                DataTransferManager datatransferManager;
                datatransferManager = DataTransferManager.GetForCurrentView();
                datatransferManager.DataRequested += new TypedEventHandler <DataTransferManager, DataRequestedEventArgs>(this.DataRequested);

                Window.Current.SizeChanged += new WindowSizeChangedEventHandler(ExtendedSplash_OnResize);
                SearchPane.GetForCurrentView().SuggestionsRequested += SearchPaneSuggestionsRequested;
                SearchPane.GetForCurrentView().QuerySubmitted       += SearchPaneQuerySubmitted;

                SettingsPane.GetForCurrentView().CommandsRequested += OnCommandsRequested;

                NotesDataSource data = new NotesDataSource();
                data.Completed += Data_Completed;
                await data.Load();
            }
            else
            {
                Data_Completed(this, null);
            }
        }
        private void SetupSearchSuggestions()
        {
            _currentSearchPane = SearchPane.GetForCurrentView();

            _currentSearchPane.PlaceholderText       = "Search for a Car by Name";
            _currentSearchPane.SuggestionsRequested += CurrentSearchPaneOnSuggestionsRequested;
        }
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     //<Snippetall_searchpane_showonkeyboardinput_on>
     // Turn on type to search.
     SearchPane.GetForCurrentView().ShowOnKeyboardInput = true;
     //</Snippetall_searchpane_showonkeyboardinput_on>
 }
Beispiel #4
0
 private void Search_Click(object sender, RoutedEventArgs e)
 {
     SearchPane.GetForCurrentView().SuggestionsRequested += SuggestionsRequested;
     SearchPane.GetForCurrentView().Show();
     SearchPane.GetForCurrentView().QuerySubmitted += QuerySubmitted;
     SearchPane.GetForCurrentView().Show();
 }
Beispiel #5
0
        private void SearchButton_Click(object sender, RoutedEventArgs e)
        {
#if WINDOWS_PHONE_APP
            if (AppSettings.EnableSingleVerticalLayoutPhone81)
            {
                SearchBoxSnapped.Visibility = Visibility.Visible;
                SearchBoxSnapped.Focus(Windows.UI.Xaml.FocusState.Programmatic);
            }
            else
            {
                SearchBox.Visibility = Visibility.Visible;
                SearchBox.Focus(Windows.UI.Xaml.FocusState.Programmatic);
            }
#endif
#if WINDOWS_APP
            try
            {
                SearchPane searchPane;
                searchPane = SearchPane.GetForCurrentView();
                if (!searchPane.Visible)
                {
                    searchPane.Show();
                }
            }
            catch
            {
                //swallow exception
            }
#endif
        }
Beispiel #6
0
        private void RegisterForSearch()
        {
            if (!_isSearchReg)
            {
                _isSearchReg = true;

                // Get Search Pane object
                this.searchPane            = SearchPane.GetForCurrentView();
                searchPane.PlaceholderText = _resourceLoader.GetString("AppSearchPlaceHolder");

                // Register for Search Pane QuerySubmitted event
                try
                {
                    this.searchPane.QuerySubmitted -= searchPane_QuerySubmitted;
                }
                catch { }
                this.searchPane.QuerySubmitted += searchPane_QuerySubmitted;
                //this.searchPane.QueryChanged += searchPane_QueryChanged;

                try
                {
                    this.searchPane.SuggestionsRequested -= searchPane_SuggestionsRequested;
                }
                catch { }
                this.searchPane.SuggestionsRequested += searchPane_SuggestionsRequested;
            }
        }
Beispiel #7
0
 public Scenario2()
 {
     this.InitializeComponent();
     // <Snippetcs_get_searchpane>
     searchPane = SearchPane.GetForCurrentView();
     // </Snippetcs_get_searchpane>
 }
Beispiel #8
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="args">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
            SearchPane.GetForCurrentView().ShowOnKeyboardInput = true;

            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                if (!rootFrame.Navigate(typeof(MainPage), args.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }
Beispiel #9
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="args">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                if (!rootFrame.Navigate(typeof(MainPage), args.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            SearchPane.GetForCurrentView().SuggestionsRequested += new TypedEventHandler <SearchPane, SearchPaneSuggestionsRequestedEventArgs>(this.OnSearchPaneSuggestionsRequested);
            SettingsPane.GetForCurrentView().CommandsRequested  += this.OnSettingsCommandsRequested;

            // Ensure the current window is active
            Window.Current.Activate();
        }
Beispiel #10
0
        private void SetupRealtimeSearchEvents()
        {
            _currentSearchPane = SearchPane.GetForCurrentView();
            _currentSearchPane.QueryChanged         += SearchPaneQueryChanged;
            _currentSearchPane.SuggestionsRequested += SearchPaneSuggestionsRequested;

            _currentSearchPane.PlaceholderText = "Search for Content";
        }
Beispiel #11
0
        /// <summary>
        /// Invoked when application execution is being suspended.  Application state is saved
        /// without knowing whether the application will be terminated or resumed with the contents
        /// of memory still intact.
        /// </summary>
        /// <param name="sender">The source of the suspend request.</param>
        /// <param name="e">Details about the suspend request.</param>
        private void OnSuspending(object sender, SuspendingEventArgs e)
        {
            SearchPane.GetForCurrentView().ShowOnKeyboardInput = false;
            var deferral = e.SuspendingOperation.GetDeferral();

            //TODO: Save application state and stop any background activity
            deferral.Complete();
        }
Beispiel #12
0
 public SplitPage()
 {
     InitializeComponent();
     App.SearchPane = SearchPane.GetForCurrentView();
     App.SearchPane.QuerySubmitted += new TypedEventHandler <SearchPane, SearchPaneQuerySubmittedEventArgs>(SearchPane_QuerySubmitted);
     ShareSourceLoad();
     ShareButton.Click += new RoutedEventHandler(ShareButton_Click);
 }
        protected override void OnNavigatedFrom(NavigationEventArgs e)
        {
            base.OnNavigatedFrom(e);

            SearchPane searchPane = SearchPane.GetForCurrentView();

            searchPane.SuggestionsRequested -= searchPane_SuggestionsRequested;
        }
Beispiel #14
0
        /// <summary>
        /// Invoked when application execution is being suspended.  Application state is saved
        /// without knowing whether the application will be terminated or resumed with the contents
        /// of memory still intact.
        /// </summary>
        /// <param name="sender">The source of the suspend request.</param>
        /// <param name="e">Details about the suspend request.</param>
        private async void OnSuspending(object sender, SuspendingEventArgs e)
        {
            SearchPane.GetForCurrentView().ShowOnKeyboardInput = true;
            var deferral = e.SuspendingOperation.GetDeferral();
            await SuspensionManager.SaveAsync();

            deferral.Complete();
        }
        /// <summary>
        /// Raised when the user loads or resumes the page
        /// Get search keyword if exists and launch search
        /// </summary>
        /// <param name="navigationParameter">Passed navigation parameters</param>
        /// <param name="pageState">Contains saved informations before the page was suspended</param>
        protected override void LoadState(object navigationParameter, Dictionary <string, object> pageState)
        {
            SearchPane.GetForCurrentView().QuerySubmitted += SearchPage_QuerySubmitted;

            if (navigationParameter != null && !string.IsNullOrWhiteSpace(navigationParameter.ToString()))
            {
                Search(navigationParameter.ToString());
            }
        }
Beispiel #16
0
 private void OnPopupClosed(object sender, object e)
 {
     _popup.Child              = null;
     Window.Current.Activated -= OnWindowActivated;
     if (_wasSearchOnKeyboardInputEnabled)
     {
         SearchPane.GetForCurrentView().ShowOnKeyboardInput = true;
     }
 }
        /// <summary>
        /// Determines if the Show On Keyboard Input feature is enabled or not.
        /// </summary>
        /// <returns>
        /// <c>true</c> if the Show On Keyboard Input feature is enabled; otherwise, <c>false</c>.
        /// </returns>
        public bool IsShowOnKeyboardInputEnabled()
        {
            if (!AppManifestHelper.IsSearchDeclared())
            {
                return(false);
            }

            return(SearchPane.GetForCurrentView().ShowOnKeyboardInput);
        }
Beispiel #18
0
        /// <summary>
        /// 在此页将要在 Frame 中显示时进行调用。
        /// </summary>
        /// <param name="e">描述如何访问此页的事件数据。Parameter
        /// 属性通常用于配置页。</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            this.Frame.Name = "SearchResultsPage.Frame";
            string QueryText = e.Parameter.ToString();

            this.txtQueryText.Text = String.Format(QueryTitle, QueryText);
            OnSearchData(null, new Views.SearchResultsEventArgs(QueryText));
            SearchPane.GetForCurrentView().ShowOnKeyboardInput = true;
        }
Beispiel #19
0
 private void SearchPaneSetup()
 {
     _searchPane = SearchPane.GetForCurrentView();
     _searchPane.PlaceholderText         = "City name or time zone";
     _searchPane.ShowOnKeyboardInput     = true;
     _searchPane.QuerySubmitted         += OnSearchPaneQuerySubmitted;
     _searchPane.SuggestionsRequested   += OnSearchPaneSuggestionsRequested;
     _searchPane.ResultSuggestionChosen += OnSearchPaneResultSuggestionChosen;
 }
Beispiel #20
0
        public void Unregister()
        {
            var searchPane = SearchPane.GetForCurrentView();

            searchPane.ShowOnKeyboardInput     = false;
            searchPane.SuggestionsRequested   -= this.OnSuggestionsRequested;
            searchPane.ResultSuggestionChosen -= this.SearchPaneOnResultSuggestionChosen;
            searchPane.QuerySubmitted         -= this.SearchPaneOnQuerySubmitted;
        }
Beispiel #21
0
        /// <summary>
        /// Preserves state associated with this page in case the application is suspended or the
        /// page is discarded from the navigation cache.  Values must conform to the serialization
        /// requirements of <see cref="SuspensionManager.SessionState"/>.
        /// </summary>
        /// <param name="pageState">An empty dictionary to be populated with serializable state.</param>
        protected override void SaveState(Dictionary <String, Object> pageState)
        {
            var selectedItem = (Comic)FlipView.SelectedItem;

            pageState["SelectedItem"] = selectedItem.Number;
            UnregisterForPrinting();
            SearchPane.GetForCurrentView().ShowOnKeyboardInput = false;
            _dataTransferManager.DataRequested -= OnDataRequested;
        }
Beispiel #22
0
        private void hotSearch_ItemClick(object sender, ItemClickEventArgs e)
        {
            var dataItem = e.ClickedItem as HotSearchInfo;

            if (dataItem != null)
            {
                SearchPane.GetForCurrentView().Show(dataItem.Name);
            }
        }
Beispiel #23
0
 public PageExplorer()
 {
     InitializeComponent();
     InitTheme();
     ExplorerItems = new ObservableCollection <ExplorerItem>();
     _searchPane   = SearchPane.GetForCurrentView();
     DataContext   = this;
     Loaded       += PageExplorer_Loaded;
 }
 /// <summary>
 /// Raises the WindowCreated event.
 /// </summary>
 /// <param name="args">The <see cref="WindowCreatedEventArgs"/> instance containing the event data.</param>
 protected override void OnWindowCreated(WindowCreatedEventArgs args)
 {
     if (AppManifestHelper.IsSearchDeclared())
     {
         // Register the Windows.ApplicationModel.Search.SearchPane.GetForCurrentView().QuerySubmitted
         // event in OnWindowCreated to speed up searches once the application is already running
         SearchPane.GetForCurrentView().QuerySubmitted += OnQuerySubmitted;
     }
 }
        // hide the pane
        public override void Hide()
        {
            base.Hide();

            // restore the state of Search charm reacting to keyboard input
            if (_keyboardInputState != null)
            {
                SearchPane.GetForCurrentView().ShowOnKeyboardInput = _keyboardInputState.Value;
            }
        }
 protected override void OnWindowCreated(WindowCreatedEventArgs args)
 {
     //<Snippetcs_searchpane_querysubmitted_register>
     //<Snippetall_searchpane_querysubmitted_register>
     // Register QuerySubmitted handler for the window at window creation time and only registered once
     // so that the app can receive user queries at any time.
     SearchPane.GetForCurrentView().QuerySubmitted += new TypedEventHandler <SearchPane, SearchPaneQuerySubmittedEventArgs>(OnQuerySubmitted);
     //</Snippetcs_searchpane_querysubmitted_register>
     //</Snippetall_searchpane_querysubmitted_register>
 }
        public void ShowSearchPane()
        {
            if (this.searchPane == null)
            {
                this.searchPane = SearchPane.GetForCurrentView();
                this.searchPane.QuerySubmitted += OnAppQuerySubmitted;
            }

            this.searchPane.Show();
        }
Beispiel #28
0
        protected override async void OnLaunched(LaunchActivatedEventArgs args)
        {
            // Intialize MarkedUp Analytics Client
            MarkedUp.AnalyticClient.Initialize("94e3584b-f3c5-4ef3-ac7b-383630ef6731");

            var rootFrame = Window.Current.Content as Frame;

            if (rootFrame == null)
            {
                // Load all channels when first started
                var model = this.Resources["Locator"] as ViewModelLocator;
                await model.Main.LoadAllChannels();

                // Load last played channel when first started
                var channelKey = ApplicationData.Current.LocalSettings.Values["LastPlayedChannel"];
                if (channelKey != null)
                {
                    foreach (var channel in model.Main.AllChannels)
                    {
                        if (channel.Key.Equals(channelKey))
                        {
                            App.PlayingMedia.SetSilentNowPlayingItem(channel);
                            model.Main.NowPlayingItem = channel;
                            break;
                        }
                    }
                }

                rootFrame = new Frame();

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                Window.Current.Content = rootFrame;
            }

            rootFrame.Style = Resources["RootFrameStyle"] as Style;

            if (rootFrame.Content == null)
            {
                if (!rootFrame.Navigate(typeof(MainPage), args.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            Window.Current.Activate();

            SearchPane.GetForCurrentView().SearchHistoryEnabled = false;

            // Init the charms options
            SettingsPane.GetForCurrentView().CommandsRequested += App_CommandsRequested;
        }
Beispiel #29
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            SettingsPane.GetForCurrentView().CommandsRequested += MainPage_CommandsRequested;

            SearchPane searchPane = SearchPane.GetForCurrentView();

            searchPane.QuerySubmitted       += searchPane_QuerySubmitted;
            searchPane.SuggestionsRequested += searchPane_SuggestionsRequested;

            base.OnNavigatedTo(e);
        }
Beispiel #30
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active

            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();
                //Associate the frame with a SuspensionManager key
                SuspensionManager.RegisterFrame(rootFrame, "AppFrame");

                if (e.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
                    }
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
                SearchPane.GetForCurrentView().SuggestionsRequested += OnSearchSuggestionRequested;
                //SearchPane.GetForCurrentView().QuerySubmitted += OnSearchQuerySubmitted;
            }
            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                if (!rootFrame.Navigate(typeof(HubPage)))
                {
                    throw new Exception("Failed to create initial page");
                }
            }
            InitSettingsPane();
            // Ensure the current window is active
            Window.Current.Activate();
        }