void btnSearch_Click(object sender, RoutedEventArgs e) { popupTags?.Hide(); if (IsSearching) { MainModel.CancelRunningSearches(); SetSearchButtonState(false); return; } if (txtSearchQuery.Text.Length < 2) { return; } SwitchWorkMode(PixivAccount.WorkMode.Search); if (MainModel?.LastSearchQuery != txtSearchQuery.Text) { SearchHistory.Insert(0, txtSearchQuery.Text); MainModel.CurrentPageResults = 1; } IsSearching = true; SetSearchButtonState(true); MainModel.ShowSearch(txtSearchQuery.Text, checkPopular.IsChecked == true, MainModel.CurrentPageResults); }
public async Task Move(int n, MyObservableCollection beginning, MyObservableCollection end, MyObservableCollection aux) { if (n > 0) { await Move(n - 1, beginning, aux, end); var b = beginning.ElementAtOrDefault(0); end.Insert(0, b); beginning.RemoveAt(0); string z = "Moved disk " + n + " from " + beginning.Name + " to " + end.Name; Steps = z; await Task.Delay(DelayMilliSecond); await Move(n - 1, aux, end, beginning); } }