コード例 #1
0
        public void UpdateCell(ReviewBase review)
        {
            this.TextLabel.Text        = review.Reviewer;
            this.DetailTextLabel.Lines = 0;
            this.DetailTextLabel.Text  = review.Review;
            this.DetailTextLabel.SizeToFit();

            // Gather up the images to be used.
            RatingConfig ratingConfig = new RatingConfig(UIImage.FromFile("Images/Stars/empty.png"), UIImage.FromFile("Images/Stars/filled.png"), UIImage.FromFile("Images/Stars/chosen.png"));

            var bounds = this.ContentView.Bounds;
            // Create the view.
            var ratingView = new PDRatingView(new RectangleF((float)bounds.Width - 70, 2f, 50f, 30f), ratingConfig, Convert.ToDecimal(review.Rating));

            foreach (var sub in this.Subviews)
            {
                var rating = sub as PDRatingView;
                if (rating != null)
                {
                    sub.RemoveFromSuperview();
                }
            }

            // [Required] Add the view to the
            this.AddSubview(ratingView);
        }
コード例 #2
0
        public async void TestMoviesGetMovieReviews()
        {
            SearchContainerWithId <ReviewBase> resp = await TMDbClient.GetMovieReviewsAsync(IdHelper.AGoodDayToDieHard);

            ReviewBase single = resp.Results.Single(s => s.Id == "5ae9d7ae0e0a26394e008aeb");

            await Verify(single);
        }
コード例 #3
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            this.SpinAndWait(false);

            if (ReviewTarget == ReviewTargetDef.Film)
            {
                this.tbReviewing.Text = SelectedFilm.Title;

                List <FilmReview> filmreviews = null;

                try
                {
                    filmreviews = await App.MobileService.GetTable <FilmReview>().Where(r => r.Movie == SelectedFilm.EDI && r.UserId == ExtendedPropertyHelper.GetUserIdentifier()).ToListAsync();
                }
                catch { }


                if (filmreviews != null && filmreviews.Count > 0)
                {
                    this.UserReview = filmreviews[0];
                }
                else
                {
                    this.UserReview = new FilmReview()
                    {
                        Reviewer = Config.UserName
                    }
                };
            }
            else
            {
                this.tbReviewing.Text = String.Format("Cineworld - {0}", SelectedCinema.Name);

                List <CinemaReview> cinemareviews = null;

                try
                {
                    cinemareviews = await App.MobileService.GetTable <CinemaReview>().Where(r => r.Cinema == SelectedCinema.ID && r.UserId == ExtendedPropertyHelper.GetUserIdentifier()).ToListAsync();
                }
                catch { }

                if (cinemareviews != null && cinemareviews.Count > 0)
                {
                    this.UserReview = cinemareviews[0];
                }
                else
                {
                    this.UserReview = new CinemaReview()
                    {
                        Reviewer = Config.UserName
                    }
                };
            }

            this.PopulateExistingReview();
        }
コード例 #4
0
        public async Task TestTvShowReviews()
        {
            await TestHelpers.SearchPagesAsync <SearchContainerWithId <ReviewBase>, ReviewBase>(i => TMDbClient.GetTvShowReviewsAsync(IdHelper.BreakingBad, page: i));

            SearchContainerWithId <ReviewBase> reviews = await TMDbClient.GetTvShowReviewsAsync(IdHelper.BreakingBad);

            ReviewBase single = reviews.Results.Single(s => s.Id == "5accdbe6c3a3687e2702d058");

            await Verify(single);
        }