async void LoadFilm(int id)
		{
			ProgressBarEnabled = true;
			CastCollection.Clear();
			CrewCollection.Clear();

			var client = new ServiceReferenceFilmInfo.WSFilmInfoPortTypeClient();
			ServiceReferenceFilmInfo.GetMovieDataByIdResponse result =
				await client.GetMovieDataByIdAsync(id);

			FilmInfo filmInfoResponse = result.@return;

			film.Id = filmInfoResponse.Id;
			film.Title = filmInfoResponse.Title;
			film.Description = filmInfoResponse.Description;
			film.Year = filmInfoResponse.Year;
			film.Poster = filmInfoResponse.Poster;
			film.Background = filmInfoResponse.Background;
			film.Summary = filmInfoResponse.Summary;
			film.Director = filmInfoResponse.Director;
			film.Rate = (double) filmInfoResponse.Rate;

			foreach (var crew in filmInfoResponse.Crew)
			{
				this.CrewCollection.Add(new MECrew()
				{
					Name = crew.Name,
					Department = crew.Department,
					Job = crew.Job,
					Picture = crew.Picture
				});

			}

			foreach (var cast in filmInfoResponse.Cast)
			{
				this.CastCollection.Add(new MECast()
				{
					Name = cast.Name,
					Character = cast.Character,
					Picture = cast.Picture
				});
			}

			UpdateAll();
			ProgressBarEnabled = false;
		}
示例#2
0
        public async void LoadCompleteFilm(VMItemFilm chosen)
        {
            Film = new VMCompleteFilm
            {
                Id          = chosen.Id,
                Year        = chosen.Year,
                Description = chosen.Description,
                Title       = chosen.Title,
                Poster      = chosen.Poster
            };

            ManageProgressBar(true);
            var client = new ServiceReferenceFilmInfo.WSFilmInfoPortTypeClient();

            ServiceReferenceFilmInfo.GetMovieDataByIdResponse result =
                await client.GetMovieDataByIdAsync(Film.Id);

            var movie = result.@return;

            Film.Rate       = Convert.ToDouble(movie.Rate);
            Film.Poster     = movie.Poster;
            Film.Background = movie.Background;
            Film.Director   = movie.Director;
            Film.Status     = movie.Status;
            Film.Summary    = movie.Summary;
            Film.Web        = movie.Web;
            Film.Cast       = new ObservableCollection <VMCast>();
            Film.Crew       = new ObservableCollection <VMCrew>();
            Film.Genres     = new ObservableCollection <string>();

            if (movie.Cast != null)
            {
                foreach (var actorInfo in movie.Cast)
                {
                    var cast = new VMCast
                    {
                        Character = actorInfo.Character,
                        Name      = actorInfo.Name,
                        Picture   = actorInfo.Picture
                    };
                    Film.Cast.Add(cast);
                }
            }

            if (movie.Crew != null)
            {
                foreach (var crewInfo in movie.Crew)
                {
                    var crew = new VMCrew()
                    {
                        Department = crewInfo.Department,
                        Job        = crewInfo.Job,
                        Name       = crewInfo.Name,
                        Picture    = crewInfo.Picture
                    };
                    Film.Crew.Add(crew);
                }
            }

            if (movie.Genres != null)
            {
                foreach (var genre in movie.Genres)
                {
                    Film.Genres.Add(genre);
                }
            }
            Film.UpdateObservables();
            ManageProgressBar(false);
        }