示例#1
0
        //Discover a movie
        public async Task DiscoverMovie()
        {
            //API needs %2C for each , between keywords
            Keyword.Replace(",", "%2C");
            //Create service and get series and genre data
            var service    = new MovieService();
            var discovered = await service.GetDiscoverMovieAsync(Media, Language, SortDecreasing, IsAdult, Vote, Keyword);

            var genreList = await service.GetGenres(Media);

            //Search for the chosen genre;
            foreach (var item in genreList.genres)
            {
                if (Genre == item.name)
                {
                    ChosenGenre = item;
                }
            }
            //Clear the list DiscoveredMovies so it wont contain old data
            DiscoveredMovie.Clear();
            //Fill up DiscoveredMovies with elements that meet the requirements
            foreach (var item in discovered.results)
            {
                if (item.genre_ids.Contains(ChosenGenre.id))
                {
                    DiscoveredMovie.Add((Movie)item);
                }
            }
            NavigationService.Navigate(typeof(MovieListPage), DiscoveredMovie);
        }
示例#2
0
        public void NavigateToDetails()
        {
            //Get the movie which name is written in the Textbox above the list
            int movieId = DiscoveredMovie.Where(x => x.title == MovieName).Single().id;

            NavigationService.Navigate(typeof(MoviePage), movieId);
        }
示例#3
0
        public void NavigateToDetailsWithClick(string movieName)
        {
            //Get the movie on which the user clicked
            int movieId = DiscoveredMovie.Where(x => x.title == movieName).Single().id;

            NavigationService.Navigate(typeof(MoviePage), movieId);
        }
示例#4
0
        public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> state)
        {
            //Create new service and get movies from a the list of MovieWithGenreIDs- that was needed for tematical search
            var service = new MovieService();

            foreach (Movie item in (ObservableCollection <Movie>)parameter)
            {
                DiscoveredMovie.Add(item);
            }

            await base.OnNavigatedToAsync(parameter, mode, state);
        }
示例#5
0
        public async Task DiscoverTrendingMovie()
        {
            //Create service and get data from API
            var service    = new MovieService();
            var discovered = await service.GetTrendingMovie(Timer);

            DiscoveredMovie.Clear();
            //Fill up the emptied DiscoveredMovie with elements that meet requirements
            foreach (var item in discovered.results)
            {
                DiscoveredMovie.Add(item);
            }
            NavigationService.Navigate(typeof(MovieListPage), DiscoveredMovie);
        }