예제 #1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public MainPage()
        {
            InitializeComponent();
            isoHelper = new IsoStorageHelper();
            hHandler = new HistoryHandler();
            isoHelper.checkIfDBFileUpdateNeeded();

            //move to Search Pivot by default
            MasterPivot.SelectedItem = SearchPivot;
        }
예제 #2
0
        /// <summary>
        /// Detect when the text is changed in the search text box.  If empty display any available search queries in the history.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void searchTextBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            //There is s bug in WP7 that causes TextBox TextChanged event to be fired twice instead of once, as is expected.  The known fix for this is to remove the secondary textbox in the TextBox control
            //by editing the TextBox Template (most easily in Blend).  Not going to address this issue at this time.

            TextBox textBox = sender as TextBox;
            HistoryHandler hHandler = new HistoryHandler();
            if (textBox.Text.Length == 0)//only do this when the search box is empty
            {
                if (!historyListLoaded && hHandler.searchHistory.Count > 0)
                {
                    browserControl.Visibility = System.Windows.Visibility.Collapsed;
                    HistoryListBox.Visibility = System.Windows.Visibility.Visible;

                    //get the history
                    HistoryListBox.ItemsSource = hHandler.searchHistory;
                    historyListLoaded = !historyListLoaded;
                }
            }
            else
            {
                if (historyListLoaded == true)
                {
                    historyListLoaded = false;
                    browserControl.Visibility = System.Windows.Visibility.Collapsed;
                    HistoryListBox.Visibility = System.Windows.Visibility.Collapsed;
                }
            }
        }