public override async void Start() { base.Start(); if (_model != null) return; _model = await _service.DetailedMovieFromId(_movieId); Title = _model.OriginalTitle; Score = _model.Score; PosterUrl = _model.PosterUrl; ReleaseDate = _model.ReleaseDate; VoteCount = _model.VoteCount; ImdbUrl = _model.ImdbId; Synopsis = _model.Overview; TagLine = _model.Tagline; Runtime = _model.Runtime; }
public async Task<DetailedMovie> DetailedMovieFromId(int id) { try { var res = await BaseClient.GetAsync(string.Format(Constants.TmdbMovieUrl, Constants.TmdbApiKey, id)); res.EnsureSuccessStatusCode(); var json = await res.Content.ReadAsStringAsync(); if (string.IsNullOrEmpty(json)) return null; var movie = JsonConvert.DeserializeObject<TmdbMovie>(json); await GetConfigurationIfNeeded(); var detailed = new DetailedMovie { Genres = movie.genres, OriginalTitle = movie.original_title, Overview = movie.overview, Score = movie.vote_average, VoteCount = movie.vote_count, ImdbId = movie.imdb_id, PosterUrl = _tmdbConfiguration.images.base_url + _tmdbConfiguration.images.poster_sizes[3] + movie.poster_path, ReleaseDate = movie.release_date, Runtime = movie.runtime, Tagline = movie.tagline }; return detailed; } catch (Exception ex) { Mvx.TaggedTrace(typeof(TmdbMovieService).Name, "Ooops! Something went wrong fetching information id: {0}. Exception: {1}", id, ex); return null; } }