protected async void OnSearch(string query) { loadingCircle.Visibility = ViewStates.Visible; emptyState.Visibility = ViewStates.Gone; if (App.IsOffline && collection != null) { if (!backupList.Any(x => x.GetPrimaryText().Contains(query, true))) { ShowEmptyState(); } adapter.ShowSearchResults(backupList, query); } else { var searchResult = await searchHandler.Invoke(query); if (searchResult != null && searchResult.ToList().Count == 0) { ShowEmptyState(); } adapter?.ShowSearchResults(searchResult?.ToList()); } loadingCircle.Visibility = ViewStates.Gone; }
private void OnSearch(object sender, TextChangedEventArgs e) { var searchResult = countriesList.ToList().FindAll(x => x.GetPrimaryText().Contains(e.Text.ToString(), true)); adapter.ShowSearchResults(searchResult); }