コード例 #1
0
        public void CreateMovieGenreView(object parameter)
        {
            PagedDocumentViewModel <MovieContainer> viewModel = null;
            DiscoverMovie movie = null;

            if (ShowDocument(Properties.Resources.MovieGenres))
            {
                viewModel = Documents.CurrentDocument as PagedDocumentViewModel <MovieContainer>;
                movie     = viewModel.Parameter as DiscoverMovie;
            }
            else
            {
                movie               = App.Repository.DiscoverMovie();
                viewModel           = ViewModelSource.Create <PagedDocumentViewModel <MovieContainer> >();
                viewModel.FetchPage = async(x, y) => await App.Repository.DiscoverMovieAsync(movie, Settings.Default.Language, x, y);

                viewModel.Header       = () => Properties.Resources.MovieGenres;
                viewModel.DocumentType = "MovieGenreView";
                viewModel.Parameter    = movie;

                viewModel.Parameters.VoteCount = 0d;
                viewModel.Parameters.SortBy    = MovieSort.PopularityDesc;

                AddToDocuments(viewModel);
            }

            viewModel.Parameters.Genre   = null;
            viewModel.Parameters.Keyword = null;
            viewModel.Parameters.Company = null;

            if (parameter != null)
            {
                viewModel.Parameters.Genre = GenreHelper.MovieGenres.Last();

                if (parameter is int genreId)
                {
                    viewModel.Parameters.Genre = GenreHelper.MovieGenres.FirstOrDefault(x => x.Id == genreId);
                }
                else if (parameter is Keyword keyword)
                {
                    viewModel.Parameters.Keyword = new SearchKeyword {
                        Id = keyword.Id, Name = keyword.Name
                    }
                }
                ;
                else if (parameter is ProductionCompany company)
                {
                    viewModel.Parameters.Company = new SearchCompany {
                        Id = company.Id, Name = company.Name
                    }
                }
                ;

                viewModel.Refresh();
            }
        }
コード例 #2
0
        public void Search(string searchText)
        {
            PagedDocumentViewModel <ContainerBase> viewModel = ViewModelSource.Create <PagedDocumentViewModel <ContainerBase> >();

            viewModel.FetchPage = async(x, y) => await App.Repository.SearchMultiAsync(searchText, Settings.Default.Language, x, y);

            viewModel.Header       = () => String.Format("{0}: {1}", Properties.Resources.Search, searchText);
            viewModel.DocumentType = "SearchView";

            AddToDocuments(viewModel);
        }
コード例 #3
0
        public void CreateOnTheAirTvShowsView()
        {
            if (ShowDocument(Properties.Resources.TVShowsAiringThisWeek))
            {
                return;
            }

            PagedDocumentViewModel <TvShowContainer> viewModel = ViewModelSource.Create <PagedDocumentViewModel <TvShowContainer> >();

            viewModel.FetchPage = async(x, y) => await App.Repository.GetTvShowOnTheAirAsync(Settings.Default.Language, x, y);

            viewModel.Header       = () => Properties.Resources.TVShowsAiringThisWeek;
            viewModel.DocumentType = "SearchView";

            AddToDocuments(viewModel);
        }
コード例 #4
0
        public void CreatePopularPeopleView()
        {
            if (ShowDocument(Properties.Resources.PopularPeople))
            {
                return;
            }

            PagedDocumentViewModel <PersonContainer> viewModel = ViewModelSource.Create <PagedDocumentViewModel <PersonContainer> >();

            viewModel.FetchPage = async(x, y) => await App.Repository.GetPersonPopularAsync(Settings.Default.Language, x, y);

            viewModel.Header       = () => Properties.Resources.PopularPeople;
            viewModel.DocumentType = "SearchView";

            AddToDocuments(viewModel);
        }
コード例 #5
0
        public void CreateNowPlayingMoviesView()
        {
            if (ShowDocument(Properties.Resources.NowPlayingMovies))
            {
                return;
            }

            PagedDocumentViewModel <MovieContainer> viewModel = ViewModelSource.Create <PagedDocumentViewModel <MovieContainer> >();

            viewModel.FetchPage = async(x, y) => await App.Repository.GetMovieNowPlayingListAsync(Settings.Default.Language, x, y);

            viewModel.Header       = () => Properties.Resources.NowPlayingMovies;
            viewModel.DocumentType = "SearchView";

            AddToDocuments(viewModel);
        }
コード例 #6
0
        public void CreateTvShowDiscoverView()
        {
            if (ShowDocument(Properties.Resources.DiscoverTvShows))
            {
                return;
            }

            DiscoverTv tvShow = App.Repository.DiscoverTvShow();
            PagedDocumentViewModel <TvShowContainer> viewModel = ViewModelSource.Create <PagedDocumentViewModel <TvShowContainer> >();

            viewModel.FetchPage = async(x, y) => await App.Repository.DiscoverTvShowAsync(tvShow, Settings.Default.Language, x, y);

            viewModel.Header       = () => Properties.Resources.DiscoverTvShows;
            viewModel.DocumentType = "TvShowDiscoverView";
            viewModel.Parameter    = tvShow;

            AddToDocuments(viewModel);
        }
コード例 #7
0
        public void CreateMovieDiscoverView()
        {
            if (ShowDocument(Properties.Resources.DiscoverMovies))
            {
                return;
            }

            DiscoverMovie movie = App.Repository.DiscoverMovie();
            PagedDocumentViewModel <MovieContainer> viewModel = ViewModelSource.Create <PagedDocumentViewModel <MovieContainer> >();

            viewModel.FetchPage = async(x, y) => await App.Repository.DiscoverMovieAsync(movie, Settings.Default.Language, x, y);

            viewModel.Header       = () => Properties.Resources.DiscoverMovies;
            viewModel.DocumentType = "MovieDiscoverView";
            viewModel.Parameter    = movie;

            AddToDocuments(viewModel);
        }