Esempio n. 1
0
        public static Collection <MovieInfo> GetMovieInfo(string title)
        {
            if (api == null)
            {
                api = new TmdbAPI("b5410cd85abf11ab7e32d6addd5d5963");
            }

            TmdbMovie[] movies;

            try
            {
                movies = api.MovieSearch(title);
            }
            catch (Exception)
            {
                return(null);
            }

            if (movies == null)
            {
                return(null);
            }

            Collection <MovieInfo> results = new Collection <MovieInfo>();

            foreach (TmdbMovie movie in movies)
            {
                MovieInfo movieInfo = new MovieInfo(movie.Name);

                movieInfo.alternativeName = movie.AlternativeName;
                movieInfo.budget          = movie.Budget;
                movieInfo.movieRuntime    = movie.MovieRuntime;
                movieInfo.overview        = movie.Overview;
                movieInfo.popularity      = movie.Popularity;
                movieInfo.rating          = movie.Rating;
                movieInfo.released        = movie.Released;
                movieInfo.revenue         = movie.Revenue;
                movieInfo.runtime         = movie.Runtime;
                movieInfo.score           = movie.Score;

                if (movie.Studios != null)
                {
                    movieInfo.studios = new Collection <string>();

                    foreach (TmdbStudio studio in movie.Studios)
                    {
                        movieInfo.studios.Add(studio.Name);
                    }
                }

                movieInfo.translated = movie.Translated;

                results.Add(movieInfo);
            }

            return(results);
        }
Esempio n. 2
0
        public void StackPanel_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if (e.ClickCount >= 2)
            {
                StackPanel temp      = (StackPanel)sender;
                TheMovieDb new_movie = (TheMovieDb)temp.DataContext;
                TmdbAPI    tmdb      = new TmdbAPI();
                movieDetails = tmdb.GetMovieDetails(new_movie.id);
                ((DiscoveryViewModel)DataContext).Model.movieDetailsView.DataContext = movieDetails;
                ((DiscoveryViewModel)DataContext).Model.CurrentView = ((DiscoveryViewModel)DataContext).Model.movieDetailsView;

                ((DiscoveryViewModel)DataContext).Model.IsMovieDetailsButtonChecked = true;
                ((DiscoveryViewModel)DataContext).Model.MovieDetailsVisibility      = "Visible";
            }
        }
Esempio n. 3
0
        public static Collection<MovieInfo> GetMovieInfo(string title)
        {
            if (api == null)
                api = new TmdbAPI("b5410cd85abf11ab7e32d6addd5d5963");

            TmdbMovie[] movies;

            try
            {
                movies = api.MovieSearch(title);
            }
            catch (Exception)
            {
                return (null);
            }

            if (movies == null)
                return (null);

            Collection<MovieInfo> results = new Collection<MovieInfo>();

            foreach (TmdbMovie movie in movies)
            {
                MovieInfo movieInfo = new MovieInfo(movie.Name);

                movieInfo.alternativeName = movie.AlternativeName;
                movieInfo.budget = movie.Budget;
                movieInfo.movieRuntime = movie.MovieRuntime;
                movieInfo.overview = movie.Overview;
                movieInfo.popularity = movie.Popularity;
                movieInfo.rating = movie.Rating;
                movieInfo.released = movie.Released;
                movieInfo.revenue = movie.Revenue;
                movieInfo.runtime = movie.Runtime;
                movieInfo.score = movie.Score;

                if (movie.Studios != null)
                {
                    movieInfo.studios = new Collection<string>();

                    foreach (TmdbStudio studio in movie.Studios)
                        movieInfo.studios.Add(studio.Name);
                }

                movieInfo.translated = movie.Translated;

                results.Add(movieInfo);
            }

            return (results);
        }
Esempio n. 4
0
 public TmdbApiFacade(TmdbAPI tmdbApi)
 {
     _tmdbApi = tmdbApi;
     //_api = new TmdbAPI( "20775617b505949e2d11b870e87cf1d6" );
 }