示例#1
0
        async Task CreatellectionAsync()
        {
            try
            {
                MovieBase Movies_top_rated = new MovieBase();

                Movies_top_rated = await cpFeeds.GetMovies("top_rated", "1");

                MoviesTop       = new ObservableCollection <MovieBase>();
                FilterMoviesTop = new ObservableCollection <MovieBase>();

                for (int a = 0; a < 10; a++)
                {
                    MoviesTop.Add(new MovieBase
                    {
                        Name          = Movies_top_rated.results[a].original_title,
                        ImageUrl      = "https://image.tmdb.org/t/p/w500/" + Movies_top_rated.results[a].poster_path,
                        ID            = Movies_top_rated.results[a].id,
                        IsVisibleStar = true,
                        overview      = Movies_top_rated.results[a].overview
                    });;
                }
                FilterMoviesTop = MoviesTop;

                Movies_top_rated = await cpFeeds.GetMovies("upcoming", "1");

                MoviesUpcoming       = new ObservableCollection <MovieBase>();
                FilterMoviesUpcoming = new ObservableCollection <MovieBase>();
                for (int a = 0; a < 10; a++)
                {
                    MoviesUpcoming.Add(new MovieBase
                    {
                        Name          = Movies_top_rated.results[a].original_title,
                        ImageUrl      = "https://image.tmdb.org/t/p/w500/" + Movies_top_rated.results[a].poster_path,
                        ID            = Movies_top_rated.results[a].id,
                        IsVisibleStar = true,
                        overview      = Movies_top_rated.results[a].overview
                    });
                }
                FilterMoviesUpcoming = MoviesUpcoming;


                Movies_top_rated = await cpFeeds.GetMovies("popular", "1");

                MoviesPopular       = new ObservableCollection <MovieBase>();
                FilterMoviesPopular = new ObservableCollection <MovieBase>();
                for (int a = 0; a < 10; a++)
                {
                    MoviesPopular.Add(new MovieBase
                    {
                        Name          = Movies_top_rated.results[a].original_title,
                        ImageUrl      = "https://image.tmdb.org/t/p/w500/" + Movies_top_rated.results[a].poster_path,
                        ID            = Movies_top_rated.results[a].id,
                        IsVisibleStar = true,
                        overview      = Movies_top_rated.results[a].overview
                    });
                }
                FilterMoviesPopular = MoviesPopular;

                Currentitem = 4;
            }
            catch (Exception e)
            {
                string ee = e.Message;
            }
        }