Exemplo n.º 1
0
        private void _searchControl_SelectionChanged(object sender, RoutedEventArgs e)
        {
            SearchSuggestionItem history = this._searchControl.SelectedItem as SearchSuggestionItem;

            if (history != null)
            {
                MainViewModel.Instance.Search(history);
            }
        }
Exemplo n.º 2
0
        public void DeleteHistory(SearchSuggestionItem history, bool ischear = false)
        {
            if (ischear)
            {
                this.SearchHistorys.Clear();
                this.SearchSuggestions.Clear();
            }
            else if (history != null)
            {
                this.SearchHistorys.Remove(history);
                this.SearchSuggestions.Remove(history);
            }

            this.SaveHostory();
        }
Exemplo n.º 3
0
        public void Search(SearchSuggestionItem history)
        {
            if (!this.SearchHistorys.Contains(history))
            {
                this.Search(history.Text);
                return;
            }

            history.Order = this.SearchHistorys.Max(_p => _p.Order) + 1;

            ResultPage newpage = new ResultPage(1, history.Text, this.NewWebCrawlers());

            ViewHelper.ShowPage(newpage);
            newpage.Start();
            this.SearchPageVisibility = Visibility.Hidden;
            this.MainPageVisibility   = Visibility.Visible;

            Task.Factory.StartNew(this.SaveHostory);
        }
Exemplo n.º 4
0
        public void Search(string paramstr)
        {
            if (!string.IsNullOrEmpty(paramstr) &&
                !string.IsNullOrWhiteSpace(paramstr))
            {
                SearchSuggestionItem history = this.SearchHistorys.FirstOrDefault(_p => _p.Text == paramstr);
                if (history == null)
                {
                    history = new SearchSuggestionItem(paramstr)
                    {
                        Order     = this.SearchHistorys.Count == 0 ? 1 : this.SearchHistorys.Max(_p => _p.Order),
                        IsHistory = true
                    };
                    this.SearchHistorys.Insert(0, history);
                }

                this.Search(history);
            }
        }
Exemplo n.º 5
0
        private void _deleteHistoryBt_Click(object sender, RoutedEventArgs e)
        {
            SearchSuggestionItem history = (sender as Button)?.Tag as SearchSuggestionItem;

            MainViewModel.Instance.DeleteHistory(history);
        }