Ejemplo n.º 1
0
        private async Task LoadSearchMoviesAsync()
        {
            try
            {
                if (_genreResults == null)
                {
                    _genreResults = await _arcTMDbApiService.GetGenresAsync();
                }

                var moviesByTitle = await _arcTMDbApiService.GetMoviesByTitleAsync(SearchTerm, ++_page);

                if (moviesByTitle != null)
                {
                    foreach (var movieDetails in moviesByTitle.Results)
                    {
                        movieDetails.GenreNames = GenreUtility.GetGenreNames(movieDetails.GenreIds, _genreResults);
                        SearchMovies.Add(movieDetails);
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
        private async Task ExecuteLoadMoreMoviesCommand()
        {
            try
            {
                if (_genreResults == null)
                {
                    _genreResults = await _arcTMDbApiService.GetGenresAsync();
                }

                var upComingMovies = await _arcTMDbApiService.GetUpcomingMoviesAsync(++_page);

                if (upComingMovies != null)
                {
                    foreach (var movieDetails in upComingMovies.Results)
                    {
                        movieDetails.GenreNames = GenreUtility.GetGenreNames(movieDetails.GenreIds, _genreResults);
                        UpComingMovies.Add(movieDetails);
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }