Inheritance: Livet.NotificationObject
Beispiel #1
0
        public SearchViewModel() : base("検索") {

            SearchResult = new SearchResultViewModel(this);

            //検索
            CurrentSearch = new NicoNicoSearch(this);

            foreach(var entry in Settings.Instance.SearchHistory) {

                SearchHistory.Add(new SearchHistoryViewModel(this, entry));
            }


        }
        //検索ボタン押下
        public void DoSearch()
        {
            if (SearchText == null || SearchText.Length == 0) {

                return;
            }

            SearchResult = new SearchResultViewModel();

            SearchResult.OwnerViewModel = this;

            SearchResult.IsActive = true;

            //検索
            currentSearch = new NicoNicoSearch(this, SearchText, SearchType, sort_by[SelectedIndex]);

            Task.Run(() => {

                NicoNicoSearchResult result = currentSearch.Search();
                //検索結果をUIに
                SearchResult.Total = string.Format("{0:#,0}", result.Total) + "件の動画";

                SearchResult.List.Clear();
                foreach(NicoNicoVideoInfoEntry node in result.List) {

                    SearchResult.List.Add(new SearchResultEntryViewModel(node));
                }

                SearchResult.IsActive = false;
            });
        }