private async void SearchButtonOnClick(object sender, RoutedEventArgs e) { if (CurrentSearch?.IsSearching == true) { CurrentSearch.StopSearch(); ChangeSearchVisual(false); return; } ChangeSearchVisual(true); var para = SearchControl.GetSearchPara(); CurrentSearch = new SearchSession(Settings, para); CurrentSearch.SearchStatusChanged += (session, s) => StatusTextBlock.Text = s; SiteTextBlock.Text = $"当前站点:{CurrentSearch.CurrentSearchPara.Site.DisplayName}"; Settings.HistoryKeywords.AddHistory(CurrentSearch.CurrentSearchPara.Keyword, Settings); var t = await CurrentSearch.TrySearchNextPageAsync(); if (t.IsCanceled || t.Exception != null) { if (!CurrentSearch.IsSearching) { ChangeSearchVisual(false); } } else { ChangeSearchVisual(false); MoeExlorer.RefreshPaging(CurrentSearch); } }
private async void NextPageButtonOnClick(object sender, RoutedEventArgs e) { ChangeSearchVisual(true); var t = await CurrentSearch.TrySearchNextPageAsync(); if (t.IsCanceled || t.Exception != null) { if (!CurrentSearch.IsSearching) { ChangeSearchVisual(false); } } else { ChangeSearchVisual(false); MoeExlorer.RefreshPaging(CurrentSearch); } }