public ViewModelPrincipal() { //CarouselView se muestra antes de ejecutar el código del viewmodel, por lo que si //la lista está vacia, el programa crashea //Instancia una nueva pelicula vacia para que el CarouselView no crashee la aplicación List <DiscoverMovie> coleccion = new List <DiscoverMovie>(); DiscoverMovie movie = new DiscoverMovie() { ID = 1, PosterPath = "", Title = "" }; coleccion.Add(movie); //Rellena la coleccion con la pelicula vacia this.InTheatreMovies = new ObservableCollection <DiscoverMovie>(coleccion); this.KidsMovies = new ObservableCollection <DiscoverMovie>(coleccion); this.SpainMovies = new ObservableCollection <DiscoverMovie>(coleccion); repoMovie = new RepositoryMovie(); //Ahora, rellena el carousel con la informacion de verdad Task.Run(async() => { DiscoverMovieRequest request = await repoMovie.DiscoverInTheatreMovies(Sort.PopularityDesc, IncludeAdult.Yes); this.InTheatreMovies = new ObservableCollection <DiscoverMovie>(request.Movies); request = await repoMovie.DiscoverSpainMovies(Sort.PopularityDesc, IncludeAdult.Yes); this.SpainMovies = new ObservableCollection <DiscoverMovie>(request.Movies); request = await repoMovie.DiscoverKidsMovies(Sort.PopularityDesc, IncludeAdult.No); this.KidsMovies = new ObservableCollection <DiscoverMovie>(request.Movies); }); }
public ViewModelBuscar() { repoMovie = new RepositoryMovie(); repoCine = new RepositoryCinema(); Task.Run(async() => { DiscoverMovieRequest request = await repoMovie.SearchMovie(CadenaBuscar); this.Movies = new ObservableCollection <DiscoverMovie>(request.Movies); }); }
public virtual Task <DiscoverMovieResponse> GetAsync(DiscoverMovieRequest request) => Client.SendAsync <DiscoverMovieResponse>(request);