public override void PrepareForReuse () { this.data = null; this.configuration = null; this.Selected = false; base.PrepareForReuse (); }
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); }
/// <summary> /// Adds to or removes the specified <see cref="Movie"/> from the user's Favorites list /// </summary> /// <param name="movie">Movie.</param> public void ToggleFavorite (Movie movie) { if (this.IsInFavorites (movie)) this.RemoveFromFavorites (movie); else this.addToFavorites (movie); }
/// <summary> /// Removes this instance of <see cref="Movie"/> from favorites. /// </summary> /// <param name="movie">Movie.</param> public void RemoveFromFavorites (Movie movie) { var existing = this.favorites.FirstOrDefault (x => x.Id == movie.Id); if (existing != null) { this.favorites.Remove (existing); this.cache.Set <List<Movie>>(SharedConstants.FavoritesCacheKey, this.favorites); this.OnFavoriteChanged (new FavoriteChangedEventArgs(movie, false)); } }
/// <summary> /// Adds this instance of <see cref="Movie"/> to favorites. /// </summary> /// <param name="movie">Movie.</param> private void addToFavorites (Movie movie) { var existing = this.favorites.FirstOrDefault (x => x.Id == movie.Id); if (existing == null) { this.favorites.Add (movie); this.cache.Set <List<Movie>> (SharedConstants.FavoritesCacheKey, this.favorites); this.OnFavoriteChanged (new FavoriteChangedEventArgs(movie, true)); } }
/// <summary> /// Determines whether this instance of <see cref="Movie"/> is in the favorites list. /// </summary> /// <returns><c>true</c> if this instance is in favorites; otherwise, <c>false</c>.</returns> /// <param name="movie">Movie.</param> public bool IsInFavorites (Movie movie) { if (this.favorites == null) return false; return this.favorites.FirstOrDefault (x => x.Id == movie.Id) != null; }
protected void OnMovieSelected (Movie movie) { if (this.MovieSelected != null) this.MovieSelected (this, movie); }
private void source_MovieSelected (object sender, Movie e) { this.selectedMovie = e; this.PerformSegue (AppleConstants.ShowMovieDetail_SegueName, this); }