private async void OnSearchClicked(object sender, EventArgs e) { var city = cityComboBox.Text; var currentSearchTerm = searchForTextBox.Text; if (string.IsNullOrEmpty(city) || string.IsNullOrEmpty(currentSearchTerm)) { return; } ResultListBox.DataSource = (await CraigsList.Search(city, currentSearchTerm)).ToList(); ResultListBox.DisplayMember = nameof(Item.Value); }
private async void OnSearchButtonPressed(object sender, EventArgs e) { string city = SearchCity.SelectedItem?.ToString(); string searchFor = SearchFor.Text; if (string.IsNullOrEmpty(city) || string.IsNullOrEmpty(searchFor)) { return; } try { Results.ItemsSource = (await CraigsList.Search(city, searchFor)).ToList(); } catch (Exception ex) { await DisplayAlert("Error", $"Failed to connect to CraigsList: {ex.Message}.", "OK"); } }