//Search for Series public async Task DiscoverSeries() { //API needs %2C between keywords Keyword.Replace(",", "%2C"); //Create new service and get series informations in a SeriesGroup var service = new MovieService(); var discovered = await service.GetDiscoverSeriesAsync(Media, Language, SortDecreasing, Vote, Keyword); //Get the list of genres and choose the one out that user was looking for var genreList = await service.GetGenres(Media); foreach (var item in genreList.genres) { if (Genre == item.name) { ChosenGenre = item; } } //Clear up the DiscoverSerieses so it would not contain old data DiscoveredSeries.Clear(); //Fill up DiscoveredSeries if the items meet requirements foreach (var item in discovered.results) { if (item.genre_ids.Contains(ChosenGenre.id)) { DiscoveredSeries.Add((Series)item); } } NavigationService.Navigate(typeof(SeriesListPage), DiscoveredSeries); }
// TODO get data from webservice public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> state) { //Create a new service and fill DiscoveredSeries with the elements of the parameter. //It is a SeriesWithGenreIDs, program needs to convert that to Series, it was needed only for tematical search var service = new MovieService(); foreach (Series item in (ObservableCollection <Series>)parameter) { DiscoveredSeries.Add(item); } await base.OnNavigatedToAsync(parameter, mode, state); }
public async Task DiscoverTrendingSeries() { //Create service and get data from API var service = new MovieService(); var discovered = await service.GetTrendingSeries(Timer); DiscoveredSeries.Clear(); //Fill up the emptied DiscoveredSeries with elements that meet requirements foreach (var item in discovered.results) { DiscoveredSeries.Add(item); } NavigationService.Navigate(typeof(SeriesListPage), DiscoveredSeries); }