Ejemplo n.º 1
0
        async Task LoadInfo()
        {
            Person = await Task.Run(() => TMDBService.GetPerson(Id));

            var movies = Person.movie_credits.cast;

            movies.AddRange(Person.movie_credits.crew);

            var shows = Person.tv_credits.cast;

            shows.AddRange(Person.tv_credits.crew);

            var distinctMovies = movies.GroupBy(x => x.title).Select(y => y.First()).ToList();
            var distinctShows  = shows.GroupBy(x => x.name).Select(y => y.First()).ToList();

            var sortedMovies = distinctMovies.OrderByDescending(v => v.popularity).ToList();
            var sortedShows  = distinctShows.OrderByDescending(v => v.popularity).ToList();

            sortedMovies.ImagesFirst().ForEach(v => Movies.Add(v));
            sortedShows.ImagesFirst().ForEach(v => Shows.Add(v));

            foreach (var v in Person.images.profiles)
            {
                if (v.file_path.Equals(Person.profile_path))
                {
                    Profiles.Add(v);
                    break;
                }
            }
            foreach (var v in Person.images.profiles)
            {
                if (!v.file_path.Equals(Person.profile_path))
                {
                    Profiles.Add(v);
                }
            }
        }