public async Task ExecuteGetPodcastsCommand() { if (IsBusy) { return; } try { IsBusy = true; var client = new HttpClient(); // Request from server podcast xml var podcastString = await client.GetStringAsync(PodcastUrl); // Parse Xml into data model and load into list var casts = ParseXml(podcastString); foreach (var cast in casts) { Podcasts.Add(cast); FilteredPodcasts.Add(cast); } } catch (Exception ex) { Debug.WriteLine("Unable to get podcasts: " + ex); } finally { IsBusy = false; } }
public void ExecuteFilterPodcastCommand(string text) { text = text.ToLower(); FilteredPodcasts.Clear(); var filtered = Podcasts.Where(podcast => podcast.Description.ToLower().Contains(text) || podcast.Name.ToLower().Contains(text)); foreach (var cast in filtered) { FilteredPodcasts.Add(cast); } OnPropertyChanged("FilteredPodcasts"); }