public override void PrepareForReuse () { this.data = null; this.configuration = null; this.Selected = false; base.PrepareForReuse (); }
public Task<ConfigurationResponse> GetConfigurationAsync () { var tcs = new TaskCompletionSource<ConfigurationResponse> (); Task.Factory.StartNew (async () => { var urlString = String.Format (SharedConstants.GetConfigurationUriFormatString, SharedConstants.ApiKey); var cacheKey = this.getCacheKey (urlString); if (this.configuration != null) { tcs.TrySetResult (this.configuration); } else { if (cache.ContainsKey(cacheKey)) { var response = cache.Get<ConfigurationResponse>(cacheKey); this.configuration = response; tcs.TrySetResult (this.configuration); } else { var client = this.httpClientFactory.Create (); var response = await client.GetAsync (urlString); var json = await response.Content.ReadAsStringAsync (); var result = JsonConvert.DeserializeObject<ConfigurationResponse> (json); this.configuration = result; cache.Set<ConfigurationResponse> (cacheKey, this.configuration); tcs.TrySetResult (this.configuration); } } }); return tcs.Task; }
public void Bind (Movie movie, ConfigurationResponse configuration) { this.data = movie; this.configuration = configuration; this.vwFavoriteIndicator.Hidden = !Data.Current.IsInFavorites (this.data); var imageUri = new Uri (String.Concat (this.configuration.Images.BaseUrl, this.configuration.Images.PosterSizes [0], this.data.PosterPath)); this.imgPoster.Image = ImageLoader.DefaultRequestImage (imageUri, this); }
public void Bind (Movie movie, ConfigurationResponse configuration) { this.data = movie; this.configuration = configuration; this.vwFavoriteIndicator.Hidden = !Data.Current.IsInFavorites (this.data); var spotlightUri = new Uri (String.Concat (this.configuration.Images.BaseUrl, this.configuration.Images.BackdropSizes [0], this.data.BackdropPath)); this.imgPoster.Image = ImageLoader.DefaultRequestImage (spotlightUri, this); this.lblTitle.Text = this.data.Title; this.lblReleaseDate.Text = String.Format ("Released in {0}", this.data.ReleaseDate.Year); var ratingConfig = new RatingConfig(UIImage.FromBundle("star_empty"), UIImage.FromBundle("star_filled"), UIImage.FromBundle("star_filled")); var averageRating = (decimal)this.data.VoteAverage / 2; this.ratingView = new PDRatingView (new CGRect(0f, 0f, this.vwVoteAverageContainer.Frame.Width, this.vwVoteAverageContainer.Frame.Height), ratingConfig, averageRating); this.vwVoteAverageContainer.Add(this.ratingView); }
public MovieCollectionViewSource (List<Movie> movies, ConfigurationResponse configuration) { this.movies = movies; this.configuration = configuration; }
private async void willAppear() { this.configuration = await Data.Current.GetConfigurationAsync (); this.categories = await Data.Current.GetMoviesByCategoryAsync (); this.spotlight = await Data.Current.GetSpotlightMoviesAsync (); if (this.tableViewSource == null) { this.tableViewSource = new MovieCategoryTableViewSource (this.configuration, this.categories); this.tableViewSource.MovieSelected += this.source_MovieSelected; this.tblMovieCategories.Source = this.tableViewSource; } else { this.tableViewSource.Reload (this.categories); } this.tblMovieCategories.ReloadData (); if (this.spotlightSource == null) { this.spotlightSource = new MovieCollectionViewSource (this.spotlight, this.configuration); this.spotlightSource.MovieSelected += this.source_MovieSelected; this.cvSpotlight.Source = this.spotlightSource; } else { this.spotlightSource.Reload (this.spotlight); } this.tblMovieCategoriesHeightConstraint.Constant = this.tblMovieCategories.ContentSize.Height; this.updateSpotlightItemSize (); this.cvSpotlight.ReloadData (); }
public SearchResultsTableViewSource (SearchResultsTableViewController controller, List<Movie> newItems, ConfigurationResponse configuration) { this.controller = controller; this.configuration = configuration; this.items = newItems; }
public MovieCategoryTableViewSource (ConfigurationResponse configuration, List<MovieCategory> categories) { this.configuration = configuration; this.categories = categories; }