public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // 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"));

            // Create the view.
            var ratingView = new PDRatingView(new RectangleF(15f, 0f, 50f, 30f), ratingConfig, Convert.ToDecimal(this.Cinema.AverageRating));

            // [Required] Add the view to the
            this.CinemaGist.AddSubview(ratingView);

            var reviewCount = new UILabel(new RectangleF(75f, 0f, 60f, 30f));

            reviewCount.Font = UIFont.FromName("HelveticaNeue", 12f);
            reviewCount.Text = String.Format("{0} ratings", this.Cinema.Reviews.Count);
            this.CinemaGist.AddSubview(reviewCount);

            this.lblAddress.Text = this.Cinema.FullAddress;

            this.lblTelephone.Text = this.Cinema.Telephone;

            this.btnWalkingDirections.TouchUpInside += Directions_TouchUpInside;
            this.btnDrivingDirections.TouchUpInside += Directions_TouchUpInside;

            UITableViewCell cell = new UITableViewCell(this.btnRateReview.Frame);

            cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
            cell.UserInteractionEnabled = false;
            this.btnRateReview.AddSubview(cell);

            this.CinemaReviewsTable.Source = new ReviewsTableSource(this.Cinema.Reviews);
            this.CinemaReviewsTable.ReloadData();
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();


            btnSend.SetTitleTextAttributes(new UITextAttributes
            {
                Font      = UIFont.FromName("Avenir-Book", 14f),
                TextColor = UIColor.White
            }, UIControlState.Normal);

            btnSend.Clicked += delegate { viewModel.SendFeedback(); };
            var ratingConfig = new RatingConfig(UIImage.FromBundle("emptyStar"), UIImage.FromBundle("filledStar"), UIImage.FromBundle("filledStar"));

            var uiRatingView = new PDRatingView(new CGRect(30, 10, userInterfaceRatingPlaceholder.Frame.Width - 60, userInterfaceRatingPlaceholder.Frame.Height - 20), ratingConfig);

            uiRatingView.RatingChosen += delegate { viewModel.UserInterfaceRating = (int)uiRatingView.ChosenRating; };

            userInterfaceRatingPlaceholder.Add(uiRatingView);
            var beerSelectionRatingView = new PDRatingView(new CGRect(30, 10, beerSelectionRatingPlaceholder.Frame.Width - 60, beerSelectionRatingPlaceholder.Frame.Height - 20), ratingConfig);

            beerSelectionRatingView.RatingChosen += delegate { viewModel.BeerSelectionRating = (int)beerSelectionRatingView.ChosenRating; };

            tbxFeedback.Changed += delegate { viewModel.Feedback = tbxFeedback.Text; };
            tbxFeedback.Started += delegate
            {
                var isDefault = tbxFeedback.Text.Contains("Write your feedback");
                if (isDefault)
                {
                    tbxFeedback.Text = string.Empty;
                }
            };
            beerSelectionRatingPlaceholder.Add(beerSelectionRatingView);
        }
        public ReviewCellView(NSString cellId) : base(UITableViewCellStyle.Default, cellId)
        {
            SelectionStyle = UITableViewCellSelectionStyle.Gray;
            //ContentView.BackgroundColor = UIColor.FromRGB(218, 255, 127);
            imageView = new UIImageView();

            userName = new UILabel()
            {
                Font            = UIFont.FromName("Verdana", 15f),
                TextColor       = UIColor.FromRGB(127, 51, 0),
                BackgroundColor = UIColor.Clear
            };
            ReviewDate = new UILabel()
            {
                Font      = UIFont.FromName("AmericanTypewriter", 10f),
                TextColor = UIColor.FromRGB(38, 127, 0),
                //TextAlignment = UITextAlignment.Center,
                BackgroundColor = UIColor.Clear
            };
            Comments = new UITextView()
            {
                Font      = UIFont.FromName("AmericanTypewriter", 14f),
                TextColor = UIColor.FromRGB(255, 127, 0),
                //TextAlignment = UITextAlignment.Center,
                BackgroundColor = UIColor.Clear
            };
            var ratingConfig = new RatingConfig(emptyImage: UIImage.FromBundle("Stars/empty.png"),
                                                filledImage: UIImage.FromBundle("Stars/filled.png"),
                                                chosenImage: UIImage.FromBundle("Stars/chosen.png"));

            stars = new PDRatingView(new CGRect(150, 2, 60, 20), ratingConfig, 5.0m);

            ContentView.AddSubviews(new UIView[] { userName, ReviewDate, Comments, stars, imageView });
        }
        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);
        }
        public void UpdateCell(FilmInfo film, UIImage image)
        {
            this.Film = film;

            this.Header.Text                     = film.TitleWithClassification;
            this.Description.Text                = film.ShortDesc;
            this.Poster.Image                    = image;
            this.Poster.Layer.CornerRadius       = 10f;
            this.Poster.Layer.MasksToBounds      = true;
            this.Poster.Layer.RasterizationScale = UIScreen.MainScreen.Scale;
            this.Poster.Layer.Opaque             = true;

            this.Duration.Text = String.Format("Duration: {0} mins", film.Runtime);

            PDRatingView ratingView;
            UILabel      reviewCount;

            foreach (var sub in this.Rating.Subviews)
            {
                sub.RemoveFromSuperview();
            }

            //if(this.Rating.Subviews.Length == 0)
            //{
            // Create the view.
            ratingView = new PDRatingView(new RectangleF(0f, 0f, 50f, 30f), ratingConfig, Convert.ToDecimal(film.AverageRating));

            // [Required] Add the view to the
            this.Rating.AddSubview(ratingView);

            reviewCount      = new UILabel(new RectangleF(60f, 0f, 60f, 30f));
            reviewCount.Font = this.Duration.Font;
            reviewCount.Text = String.Format("{0} ratings", film.Reviews.Count);
            this.Rating.AddSubview(reviewCount);
            //}
            //else
            //{
            //	foreach(var sub in this.Rating.Subviews)
            //	{
            //		ratingView = sub as PDRatingView;
            //		if(ratingView != null)
            //		{
            //			ratingView.AverageRating = Convert.ToDecimal (film.AverageRating);
            //			break;
            //		}
            //
            //		reviewCount = sub as UILabel;
            //		if (reviewCount != null)
            //		{
            //			reviewCount.Text = String.Format ("{0} ratings", film.Reviews.Count);
            //		}
            //	}
            //}
        }
Esempio n. 6
0
        public ReviewCellView(NSString cellId) : base(UITableViewCellStyle.Default, cellId)
        {
            try
            {
                SelectionStyle = UITableViewCellSelectionStyle.Gray;
                //ContentView.BackgroundColor = UIColor.FromRGB(218, 255, 127);
                imageView = new UIImageView();
                //ContentView.BackgroundColor = UIColor.Cyan;
                userName = new UILabel()
                {
                    Font            = UIFont.FromName("Verdana", 15f),
                    TextColor       = UIColor.FromRGB(127, 51, 0),
                    BackgroundColor = UIColor.Clear
                };
                ReviewDate = new UILabel()
                {
                    Font            = UIFont.FromName("AmericanTypewriter", 10f),
                    TextColor       = UIColor.FromRGB(38, 127, 0),
                    BackgroundColor = UIColor.Clear,
                    //TextAlignment = UITextAlignment.Center,
                    //BackgroundColor = UIColor.Clear
                };
                Comments = new UITextView()
                {
                    Font            = UIFont.FromName("AmericanTypewriter", 14f),
                    TextColor       = UIColor.FromRGB(255, 127, 0),
                    TextAlignment   = UITextAlignment.Justified,
                    BackgroundColor = UIColor.Clear,
                    Editable        = false
                };
                Readmore = new UIBotton();
                Readmore.SetTitle("...ReadMore", UIControlState.Normal);
                Readmore.SetTitleColor(UIColor.Black, UIControlState.Normal);
                Readmore.BackgroundColor = UIColor.Clear;
                var ratingConfig = new RatingConfig(emptyImage: UIImage.FromBundle("Stars/star-silver2.png"),
                                                    filledImage: UIImage.FromBundle("Stars/star.png"),
                                                    chosenImage: UIImage.FromBundle("Stars/star.png"));

                stars = new PDRatingView(new CGRect(ContentView.Bounds.Width - 200, 20, 60, 25), ratingConfig, 5.0m);

                ContentView.AddSubviews(new UIView[] { userName, ReviewDate, Comments, stars, imageView, Readmore });
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
            }
        }
Esempio n. 7
0
        public override void ViewDidLoad()
        {
            viewModel = ServiceLocator.Instance.Resolve <ICheckInViewModel>();
            logger    = ServiceLocator.Instance.Resolve <IAppInsights>();

            lblBeerName.Text = beer.Name;
            lblDate.Text     = DateTime.Now.ToString("M");

            starView.BackgroundColor = ratingView.BackgroundColor;

            RatingConfig ratingConfig  = new RatingConfig(UIImage.FromFile("star_blue_empty.png"), UIImage.FromFile("star_blue_filled.png"), UIImage.FromFile("star_blue_filled.png"));
            decimal      averageRating = 3;

            var starsView = new PDRatingView(starView.Bounds, ratingConfig, averageRating);

            starsView.Center = new CoreGraphics.CGPoint(View.Center.X - 10, starView.Frame.Y + 10);

            starsView.RatingChosen += (sender, e) =>
            {
                rating = e.Rating;
            };
            starView.Add(starsView);
            starView.LayoutSubviews();
        }
        public APLCollectionViewCell(CGRect frame) : base(frame)
        {
            try
            {
                //BTProgressHUD.Show("Please wait...");
                CGRect box = new CGRect(Bounds.Location, Bounds.Size);
                box.X           = 0;
                box.Y           = 0;
                box.Height      = box.Height - 140;
                BackgroundColor = UIColor.White;

                btnBack = new UIButton();
                btnBack.BackgroundColor        = UIColor.Black;
                btnBack.Frame                  = new CGRect(2, 2, Bounds.Width + 1, box.Height - 139);
                btnBack.UserInteractionEnabled = false;

                ImageView = new UIButton(box);
                ImageView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
                ImageView.ContentMode      = UIViewContentMode.ScaleAspectFill;
                //ImageView.Layer.BorderWidth = 3.0f;
                ImageView.ClipsToBounds              = true;
                ImageView.Layer.BorderColor          = UIColor.White.CGColor;
                ImageView.Layer.EdgeAntialiasingMask = CAEdgeAntialiasingMask.LeftEdge | CAEdgeAntialiasingMask.RightEdge | CAEdgeAntialiasingMask.BottomEdge | CAEdgeAntialiasingMask.TopEdge;

                box.Y    = 3;
                btlImage = new UIButton(box);
                btlImage.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
                //btlImage.ContentMode = UIViewContentMode.ScaleAspectFill;
                btlImage.ClipsToBounds              = true;
                btlImage.Layer.BorderColor          = UIColor.White.CGColor;
                btlImage.Layer.EdgeAntialiasingMask = CAEdgeAntialiasingMask.LeftEdge | CAEdgeAntialiasingMask.RightEdge | CAEdgeAntialiasingMask.BottomEdge | CAEdgeAntialiasingMask.TopEdge;

                //btlImage.TouchDown += (sender, e) =>
                //{
                //		BTProgressHUD.Show("Loading..."); //show spinner + text
                //};

                btlImage.TouchUpInside += (object sender, EventArgs e) =>
                {
                    BTProgressHUD.Show("Loading...");
                    //BTProgressHUD.Dismiss();
                    NavigationController.PushViewController(new DetailViewController(WineBarcode, storeId, false, false), false);
                    LoggingClass.LogInfo("Clicked on " + WineBarcode + " to enter into Details", screen);
                };

                box.Height = 25;
                box.Width  = 25;
                box.X      = (Bounds.Width - 30);
                box.Y      = 5;
                heartImage = new UIButton(box);
                heartImage.ClipsToBounds              = true;
                heartImage.Layer.BorderColor          = UIColor.White.CGColor;
                heartImage.Layer.EdgeAntialiasingMask = CAEdgeAntialiasingMask.LeftEdge | CAEdgeAntialiasingMask.RightEdge | CAEdgeAntialiasingMask.BottomEdge | CAEdgeAntialiasingMask.TopEdge;
                heartImage.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                heartImage.Tag            = 0;
                heartImage.TouchUpInside += async(object sender, EventArgs e) =>
                {
                    //Do some actionn
                    if (CurrentUser.RetreiveUserId() != 0)
                    {
                        UIButton temp = (UIButton)sender;
                        if (temp.Tag == 0)
                        {
                            heartImage.SetImage(UIImage.FromFile("heart_full.png"), UIControlState.Normal);
                            temp.Tag      = 1;
                            myItem.IsLike = true;
                            LoggingClass.LogInfo("Liked Wine " + WineBarcode, screen);
                        }
                        else
                        {
                            heartImage.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                            temp.Tag      = 0;
                            myItem.IsLike = false;
                            LoggingClass.LogInfo("Unliked Wine " + WineBarcode, screen);
                        }
                        //NavigationController.PushViewController(new DetailViewController(), false);
                        SKULike like = new SKULike();
                        like.UserID  = Convert.ToInt32(CurrentUser.RetreiveUserId());
                        like.BarCode = WineBarcode;
                        like.Liked   = Convert.ToBoolean(temp.Tag);
                        ServiceWrapper sw = new ServiceWrapper();
                        await sw.InsertUpdateLike(like);
                    }
                    else
                    {
                        UIAlertView alert = new UIAlertView()
                        {
                            Title = "This feature is allowed only for VIP Card holders",
                            //Message = "Coming Soon..."
                        };
                        alert.AddButton("OK");
                        alert.AddButton("Know more");
                        alert.Clicked += (senderalert, buttonArgs) =>
                        {
                            if (buttonArgs.ButtonIndex == 1)
                            {
                                UIApplication.SharedApplication.OpenUrl(new NSUrl("https://hangoutz.azurewebsites.net/index.html"));
                            }
                        };
                        //alert.AlertViewStyle = UIAlertViewStyle.PlainTextInput;

                        alert.Show();
                    }
                };

                //for buy button
                box.Height                        = 35;
                box.Width                         = 35;
                box.X                             = (Bounds.Width - 40);
                box.Y                             = 40;
                btnBuy                            = new UIButton(box);
                btnBuy.ClipsToBounds              = true;
                btnBuy.Layer.BorderColor          = UIColor.White.CGColor;
                btnBuy.Layer.EdgeAntialiasingMask = CAEdgeAntialiasingMask.LeftEdge | CAEdgeAntialiasingMask.RightEdge | CAEdgeAntialiasingMask.BottomEdge | CAEdgeAntialiasingMask.TopEdge;
                btnBuy.SetImage(UIImage.FromFile("buy.png"), UIControlState.Normal);
                btnBuy.TouchUpInside += delegate {
                    NavigationController.PushViewController(new ExploreViewController("http://www.wineoutlet.com/sku" + Sku + ".html"), false);
                    //UIApplication.SharedApplication.OpenUrl(new NSUrl("http://www.wineoutlet.com/sku"+Sku+".html"));
                };

                CGRect lower = new CGRect(Bounds.Location, Bounds.Size);
                lower.Y     = 50;             //lower.Y + (ratio)*(Bounds.Height);
                btnItemname = new UIButton(lower);
                btnItemname.SetTitle("", UIControlState.Normal);
                btnItemname.SetTitleColor(UIColor.Purple, UIControlState.Normal);
                btnItemname.Font           = UIFont.FromName("Verdana-Bold", 13f);
                btnItemname.LineBreakMode  = UILineBreakMode.WordWrap;
                btnItemname.TouchUpInside += (object sender, EventArgs e) =>
                {
                    BTProgressHUD.Show("Loading...");
                    //BTProgressHUD.Dismiss();
                    NavigationController.PushViewController(new DetailViewController(WineBarcode, storeId, false, false), false);
                    LoggingClass.LogInfo("Clicked on " + WineBarcode + " to enter into Details", screen);
                };
                lblName               = new UILabel(lower);
                lblName.Font          = UIFont.FromName("Verdana-Bold", 13f);
                lblName.TextColor     = UIColor.Purple;
                lblName.Text          = WineName;
                lblName.TextAlignment = UITextAlignment.Center;
                lblName.LineBreakMode = UILineBreakMode.WordWrap;
                lblName.Lines         = 0;


                lower.Y      = 245;
                lower.Height = 1;
                lower.Width  = lower.Width - 20;
                lower.X      = lower.X + 10;

                Separator = new UIImageView(lower);
                Separator.AutoresizingMask  = UIViewAutoresizing.FlexibleWidth;
                Separator.Image             = UIImage.FromFile("separator.png");
                Separator.ContentMode       = UIViewContentMode.ScaleAspectFill;
                Separator.ClipsToBounds     = true;
                Separator.Layer.BorderColor = UIColor.White.CGColor;
                Separator.BackgroundColor   = UIColor.LightGray;

                CGRect year = new CGRect(Bounds.Location, Bounds.Size);
                year.Y                  = lower.Y - 15;
                year.X                  = year.Width / 2 - 25;
                year.Height             = 30;
                year.Width              = 50;
                lblYear                 = new UILabel(year);
                lblYear.Font            = UIFont.FromName("Verdana", 12f);
                lblYear.Text            = Vintage;
                lblYear.TextAlignment   = UITextAlignment.Center;
                lblYear.BackgroundColor = UIColor.White;


                lblRegPrice      = new UILabel(new CGRect(0, Bounds.Height - 60, Bounds.Width, 12f));
                lblRegPrice.Text = RegPrice;

                lblRegPrice.Font = UIFont.FromName("Verdana", 13f);

                lblRegPrice.TextAlignment = UITextAlignment.Center;

                var ratingConfig = new RatingConfig(emptyImage: UIImage.FromBundle("Stars/star-silver2.png"),
                                                    filledImage: UIImage.FromBundle("Stars/star.png"),
                                                    chosenImage: UIImage.FromBundle("Stars/star.png"));
                //decimal averageRating = 3.25m;

                ratingView = new PDRatingView(new CGRect(Bounds.Width * 1 / 4, Bounds.Height - 40, Bounds.Width / 2, 14f), ratingConfig, averageRating);
                ratingView.UserInteractionEnabled = false;
                //ratingView.BackgroundColor = UIColor.White;
                //Console.WriteLine(Sku);
                //if (Sku != null)
                //{
                //ContentView.AddSubview(btnBuy);
                //}

                AmountLeft = new UITextView(new CGRect(0, Bounds.Height - 30, Bounds.Width, 20));
                AmountLeft.TextAlignment = UITextAlignment.Center;
                AmountLeft.Editable      = false;
                //AmountLeft.ProgressTintColor = UIColor.Blue;
                //AmountLeft.SetProgress(1, true);
                //AmountLeft.Progress = 30f;
                //ContentView.AddSubview(btnBack);
                ContentView.AddSubview(ImageView);
                ContentView.InsertSubviewAbove(btlImage, ImageView);
                ContentView.AddSubview(AmountLeft);
                ContentView.AddSubview(heartImage);
                //ContentView.AddSubview(lblName);
                ContentView.AddSubview(btnItemname);
                ContentView.AddSubview(Separator);
                ContentView.AddSubview(lblYear);
                ContentView.AddSubview(lblRegPrice);
                ContentView.AddSubview(ratingView);
                ContentView.AddSubview(btnBuy);
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
            }
        }
Esempio n. 9
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.imgPoster.Layer.CornerRadius       = 10f;
            this.imgPoster.Layer.MasksToBounds      = true;
            this.imgPoster.Layer.RasterizationScale = UIScreen.MainScreen.Scale;
            this.imgPoster.Layer.Opaque             = true;

            if (!String.IsNullOrWhiteSpace(this.Film.YoutubeTrailer))
            {
                this.btnTrailer.Hidden = false;

                this.btnTrailer.Layer.CornerRadius       = 10f;
                this.btnTrailer.Layer.MasksToBounds      = true;
                this.btnTrailer.Layer.RasterizationScale = UIScreen.MainScreen.Scale;
                this.btnTrailer.Layer.Opaque             = true;
            }

            string url   = this.Film.PosterUrl == null ? null : this.Film.PosterUrl.OriginalString;
            var    image = ImageManager.Instance.GetImage(url);

            if (image == null)
            {
                image = UIImage.FromFile("Images/PlaceHolder.png");
            }

            this.imgPoster.Image = ImageHelper.ResizeImage(image, 109, 163);

            // 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"));

            // Create the view.
            var ratingView = new PDRatingView(new RectangleF(0f, 0f, 60f, 25f), ratingConfig, Convert.ToDecimal(this.Film.AverageRating));

            this.viewMisc.AddSubview(ratingView);

            var reviewCount = new UILabel(new RectangleF(70f, 0f, (float)(this.viewMisc.Bounds.Width - 60), 25f));

            reviewCount.Font  = UIFont.FromName("HelveticaNeue", 12f);
            reviewCount.Lines = 1;
            reviewCount.Text  = String.Format("{0} ratings", this.Film.Reviews.Count);
            this.viewMisc.AddSubview(reviewCount);

            var durationLabel = new UILabel(new RectangleF(0f, 25f, (float)this.viewMisc.Bounds.Width, 25f));

            durationLabel.Font  = UIFont.FromName("HelveticaNeue", 12f);
            durationLabel.Lines = 0;
            durationLabel.Text  = String.Format("Duration {0} mins", this.Film.Runtime);
            this.viewMisc.AddSubview(durationLabel);

            var releaseLabel = new UILabel(new RectangleF(0f, 50f, (float)this.viewMisc.Bounds.Width, 25f));

            releaseLabel.Font  = UIFont.FromName("HelveticaNeue", 12f);
            releaseLabel.Lines = 0;
            releaseLabel.Text  = String.Format("Release {0}", this.Film.ReleaseDate);
            this.viewMisc.AddSubview(releaseLabel);

            if (!String.IsNullOrWhiteSpace(this.Film.Overview))
            {
                this.lblOverview.Text = this.Film.Overview;
                this.lblOverview.SizeToFit();
            }
            else
            {
                this.lblOverview.Hidden = this.lblOverviewHeader.Hidden = true;
            }
        }
Esempio n. 10
0
        public override void ViewDidLoad()
        {
            try
            {
                UIToolbar toolbar = new UIToolbar(new RectangleF(0.0f, 0.0f, Convert.ToSingle(this.View.Frame.Size.Width), 44.0f));
                //toolbar.TintColor = UIColor.White;
                //toolbar.BarStyle = UIBarStyle.Black;
                //toolbar.Translucent = true;
                toolbar.Items = toolbar.Items = new UIBarButtonItem[]
                {
                    new UIBarButtonItem(UIBarButtonSystemItem.Done, delegate { this.txtComments.ResignFirstResponder(); })
                };
                //AboutController1.ViewDidLoad(base);
                this.View.BackgroundColor = new UIColor(0, 0, 0, 0.8f);
                nfloat y           = 40;
                var    lblProducer = new UILabel();
                lblProducer.Frame           = new CGRect(4, 180 - y, View.Frame.Width - 8, 30);
                lblProducer.Text            = "My Tasting";
                lblProducer.BackgroundColor = UIColor.Purple;
                lblProducer.TextAlignment   = UITextAlignment.Center;
                lblProducer.TextColor       = UIColor.White;
                this.View.AddSubview(lblProducer);
                lblTrans                 = new UILabel();
                lblTrans.Frame           = new CGRect(0, 0, View.Frame.Width, View.Frame.Height);
                lblTrans.BackgroundColor = new UIColor(0, 0, 0, 0.0f);
                this.View.AddSubview(lblTrans);

                //this.View.Alpha = 0.5f;
                UIButton btnClose = new UIButton(new CGRect(9, 185 - y, 20, 20));
                btnClose.SetBackgroundImage(new UIImage("Close.png"), UIControlState.Normal);
                this.View.AddSubview(btnClose);

                btnClose.TouchUpInside += (sender, e) =>
                {
                    NavController.DismissViewController(true, null);
                };

                imgBtl       = new UIImageView(new CGRect(View.Frame.Width - 64, 149 - y, 60, 60));
                imgBtl.Image = UIImage.FromFile("wine_review.png");
                //imgBtl.BackgroundColor = UIColor.White;
                this.View.AddSubview(imgBtl);

                lblWhite                 = new UILabel();
                lblWhite.Frame           = new CGRect(4, 210 - y, View.Frame.Width - 8, 200);     //200
                lblWhite.BackgroundColor = UIColor.White;
                lblWhite.TextAlignment   = UITextAlignment.Center;
                this.View.AddSubview(lblWhite);

                var Separator = new UIImageView(new CGRect(14, 225 - y, View.Frame.Width - 28, 2));
                Separator.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
                Separator.Image            = UIImage.FromFile("separator.png");
                this.View.AddSubview(Separator);


                var ratingConfig = new RatingConfig(emptyImage: UIImage.FromBundle("Stars/empty.png"),
                                                    filledImage: UIImage.FromBundle("Stars/star.png"),
                                                    chosenImage: UIImage.FromBundle("Stars/star.png"));

                var lblStarBack = new UILabel();
                lblStarBack.Frame           = new CGRect(View.Bounds.Width * 3 / 9, 210 - y, View.Bounds.Width / 3, 35f);
                lblStarBack.BackgroundColor = UIColor.White;
                lblStarBack.TextAlignment   = UITextAlignment.Center;
                this.View.AddSubview(lblStarBack);

                // Create the view.
                decimal      averageRating = StartsSelected;
                PDRatingView ratingView    = new PDRatingView(new CGRect(View.Bounds.Width * 3 / 8, 210 - y, View.Bounds.Width / 4, 35f), ratingConfig, averageRating);
                //ratingView.UserInteractionEnabled = true

                ratingView.BackgroundColor = UIColor.White;
                ratingView.RatingChosen   += (sender, e) =>
                {
                    StartsSelected = e.Rating;
                };
                this.View.AddSubview(ratingView);


                txtComments       = new UITextView();
                txtComments.Frame = new CGRect(14, 250 - y, View.Frame.Width - 28, 130);
                //txtComments.Text = "Describe your testing";
                //txtComments.TextAlignment = UITextAlignment.Justified;
                //txtComments.BackgroundColor = UIColor.LightGray;
                txtComments.Text = Comments.Length > 0 ? Comments : "Describe your tasting";
                txtComments.InputAccessoryView = toolbar;
                txtComments.Started           += (sender, e) =>
                {
                    if (((UITextView)sender).Text == "Describe your tasting")
                    {
                        ((UITextView)sender).Text = "";
                    }
                };
                txtComments.BecomeFirstResponder();
                this.View.AddSubview(txtComments);

                UIButton btnSave = new UIButton(new CGRect(14, 370 - y, View.Frame.Width - 28, 20));
                //btnSave.SetBackgroundImage(new UIImage("Close.png"), UIControlState.Normal);
                btnSave.SetTitle("SAVE", UIControlState.Normal);
                btnSave.HorizontalAlignment = UIControlContentHorizontalAlignment.Right;
                btnSave.SetTitleColor(UIColor.Purple, UIControlState.Normal);
                LoggingClass.LogInfo("Added review to the " + WineId, screen);
                this.View.AddSubview(btnSave);
                btnSave.TouchDown += (sender, e) =>
                {
                    if (CurrentUser.RetreiveUserId() == 0)
                    {
                        UIAlertView alert = new UIAlertView()
                        {
                            Title = "This feature is allowed only for VIP Card holders",
                            //Message = "Coming Soon..."
                        };
                        //LoggingClass.LogInfo("Clicked on seacuces", screenid);
                        alert.AddButton("OK");
                        alert.AddButton("Know more");
                        alert.Clicked += (senderalert, buttonArgs) =>
                        {
                            if (buttonArgs.ButtonIndex == 1)
                            {
                                UIApplication.SharedApplication.OpenUrl(new NSUrl("https://hangoutz.azurewebsites.net/index.html"));
                            }
                        };
                        alert.Show();
                    }
                    else
                    {
                        BTProgressHUD.Show("Saving review...");                         //show spinner + text
                    }
                };
                btnSave.TouchUpInside += (sender, e) =>
                {
                    if (CurrentUser.RetreiveUserId() == 0)
                    {
                        UIAlertView alert = new UIAlertView()
                        {
                            Title = "This feature is allowed only for VIP Card holders",
                            //Message = "Coming Soon..."
                        };
                        //LoggingClass.LogInfo("Clicked on seacuces", screenid);
                        alert.AddButton("OK");
                        alert.AddButton("Know more");
                        alert.Clicked += (senderalert, buttonArgs) =>
                        {
                            if (buttonArgs.ButtonIndex == 1)
                            {
                                UIApplication.SharedApplication.OpenUrl(new NSUrl("https://hangoutz.azurewebsites.net/index.html"));
                            }
                        };
                        alert.Show();
                    }
                    else
                    {
                        NavController.DismissViewController(true, null);
                        SaveReview();
                    }
                };
                DismissKeyboardOnBackgroundTap();
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
            }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            this.View.BackgroundColor = new UIColor(0, 0, 0, 0.8f);


            var lblProducer = new UILabel();

            lblProducer.Frame           = new CGRect(4, 180, View.Frame.Width - 8, 30);
            lblProducer.Text            = "My Tasting";
            lblProducer.BackgroundColor = UIColor.Purple;
            lblProducer.TextAlignment   = UITextAlignment.Center;
            this.View.AddSubview(lblProducer);

            //this.View.Alpha = 0.5f;
            UIButton btnClose = new UIButton(new CGRect(9, 185, 20, 20));

            btnClose.SetBackgroundImage(new UIImage("Close.png"), UIControlState.Normal);
            this.View.AddSubview(btnClose);

            UIImageView imgBtl = new UIImageView(new CGRect(View.Frame.Width - 64, 149, 60, 60));

            imgBtl.Image = UIImage.FromFile("wine_review.png");
            //imgBtl.BackgroundColor = UIColor.White;
            this.View.AddSubview(imgBtl);

            var lblWhite = new UILabel();

            lblWhite.Frame           = new CGRect(4, 210, View.Frame.Width - 8, 200);
            lblWhite.BackgroundColor = UIColor.White;
            lblWhite.TextAlignment   = UITextAlignment.Center;
            this.View.AddSubview(lblWhite);

            var Separator = new UIImageView(new CGRect(14, 225, View.Frame.Width - 28, 2));

            Separator.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
            Separator.Image            = UIImage.FromFile("separator.png");
            this.View.AddSubview(Separator);


            var ratingConfig = new RatingConfig(emptyImage: UIImage.FromBundle("Stars/empty.png"),
                                                filledImage: UIImage.FromBundle("Stars/filled.png"),
                                                chosenImage: UIImage.FromBundle("Stars/chosen.png"));

            var lblStarBack = new UILabel();

            lblStarBack.Frame           = new CGRect(View.Bounds.Width * 3 / 9, 210, View.Bounds.Width / 3, 35f);
            lblStarBack.BackgroundColor = UIColor.White;
            lblStarBack.TextAlignment   = UITextAlignment.Center;
            this.View.AddSubview(lblStarBack);

            // Create the view.
            decimal      averageRating = 3.25m;
            PDRatingView ratingView    = new PDRatingView(new CGRect(View.Bounds.Width * 3 / 8, 210, View.Bounds.Width / 4, 35f), ratingConfig, averageRating);

            ratingView.UserInteractionEnabled = false;
            ratingView.BackgroundColor        = UIColor.White;
            this.View.AddSubview(ratingView);

            var txtComments = new UITextView();

            txtComments.Frame = new CGRect(14, 240, View.Frame.Width - 28, 130);
            txtComments.Text  = "Describe your testing";
            //txtComments.TextAlignment = UITextAlignment.Justified;
            //txtComments.BackgroundColor = UIColor.LightGray;
            txtComments.Text     = "Describe your testing";
            txtComments.Started += (sender, e) => {
                ((UITextView)sender).Text = "";
            };
            this.View.AddSubview(txtComments);


            UIButton btnSave = new UIButton(new CGRect(14, 370, View.Frame.Width - 28, 20));

            //btnSave.SetBackgroundImage(new UIImage("Close.png"), UIControlState.Normal);
            btnSave.SetTitle("SAVE", UIControlState.Normal);
            btnSave.HorizontalAlignment = UIControlContentHorizontalAlignment.Right;
            btnSave.SetTitleColor(UIColor.Purple, UIControlState.Normal);
            this.View.AddSubview(btnSave);
        }
Esempio n. 12
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();


            var gradientLayer = new CAGradientLayer();

            gradientLayer.Colors = new[] { UIColor.FromRGB(98, 107, 186).CGColor, UIColor.FromRGB(57, 122, 193).CGColor };
            gradientLayer.Frame  = new CGRect(0, 0, HeaderView.Frame.Width + 50, HeaderView.Frame.Height);
            HeaderView.Layer.InsertSublayer(gradientLayer, 0);

            CALayer profileImageCircle = ProviderDisplayPicture.Layer;

            profileImageCircle.CornerRadius  = 40;
            profileImageCircle.BorderColor   = UIColor.FromRGB(98, 107, 186).CGColor;
            profileImageCircle.BorderWidth   = 3;
            profileImageCircle.MasksToBounds = true;

            var ratingConfig = new RatingConfig(emptyImage: UIImage.FromFile("empty"),
                                                filledImage: UIImage.FromFile("chosen"),//filled
                                                chosenImage: UIImage.FromFile("chosen"));
            // Create the view.
            decimal averageRating      = Rating;
            decimal halfRoundedRating  = Math.Round(averageRating * 2m, MidpointRounding.AwayFromZero) / 2m;
            decimal wholeRoundedRating = Math.Round(averageRating, MidpointRounding.AwayFromZero);

            ratingView = new PDRatingView(new CGRect(155, lblProviderMobileNo.Frame.Top + lblProviderMobileNo.Frame.Height - 30, lblProviderMobileNo.Bounds.Width + 10, 100), ratingConfig, averageRating);

            ratingView.AverageRating = wholeRoundedRating;
            View.Add(ratingView);

            var imageBytes = Convert.FromBase64String(Image);
            var imageData  = NSData.FromArray(imageBytes);
            var UserImage  = UIImage.LoadFromData(imageData);

            ProviderDisplayPicture.Image = UserImage;
            ProviderWallPicture.Image    = UserImage;
            lblProviderName.Text         = Name;
            lblProviderMobileNo.Text     = MobileNumber;
            lblEmailId.Text = EmailID;
            lblAddress.Text = Addres;

            btnBack.TouchUpInside += (sender, e) =>
            {
                this.NavigationController.PopViewController(true);
            };

            btnReportProvider.TouchUpInside += (sender, e) =>
            {
                ReportProviderViewController _VC = this.Storyboard.InstantiateViewController("ReportProviderViewController") as ReportProviderViewController;
                if (_VC != null)
                {
                    _VC.ModalPresentationStyle = UIModalPresentationStyle.OverCurrentContext;
                    _VC.ModalTransitionStyle   = UIModalTransitionStyle.CoverVertical;
                    this.PresentViewController(_VC, true, null);
                }
            };

            btnReviewbyOther.TouchUpInside += (sender, e) =>
            {
                ConsumerReviewViewController reviewController = this.Storyboard.InstantiateViewController("ConsumerReviewViewController") as ConsumerReviewViewController;
                if (reviewController != null)
                {
                    this.NavigationController.PushViewController(reviewController, true);
                }
            };

            btnAvailableProducts.TouchUpInside += (sender, e) =>
            {
                AvailableProductsViewController _vc = this.Storyboard.InstantiateViewController("AvailableProductsViewController") as AvailableProductsViewController;
                if (_vc != null)
                {
                    this.NavigationController.PushViewController(_vc, true);
                }
            };
        }
        public void Internal_ViewDidLoad(Boolean refresh)
        {
            try
            {
                LoggingClass.LogInfo("Entered into detail view of " + _wineId, screen);
                //BTProgressHUD.Show();
                nfloat width = View.Frame.Width;
                ItemDetailsResponse mydata = svc.GetItemDetailsBarcode(_wineId, _storeId).Result;
                //ItemReviewResponse rv = svc.GetItemReviewUID(CurrentUser.RetreiveUserId()).Result;
                var data = mydata.ItemDetails;
                if (data.Barcode != null)
                {
                    var lblName = new UILabel();
                    lblName.Frame         = new CGRect(0, 0, width, 40);
                    lblName.Text          = data.Name;
                    lblName.Font          = UIFont.FromName("Verdana-Bold", 16f);
                    lblName.TextAlignment = UITextAlignment.Center;
                    lblName.TextColor     = UIColor.Purple;

                    //var Separator = new UIImageView();
                    //Separator.Frame = new CGRect(0, 50, View.Frame.Width, 2);
                    //Separator.Image = UIImage.FromFile("separator.png");

                    var lblVintage = new UILabel();
                    lblVintage.Frame = new CGRect(View.Frame.Width / 2 - 10, 40, 40, 20);
                    double l = Math.Floor(Math.Log10(data.Vintage) + 1);
                    if (l < 4)
                    {
                        lblVintage.Text = " ";
                    }
                    else
                    {
                        lblVintage.Text = data.Vintage.ToString();
                    }
                    lblVintage.Font            = UIFont.FromName("Verdana", 12f);
                    lblVintage.TextAlignment   = UITextAlignment.Center;
                    lblVintage.BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile("line123.png"));


                    var btlImage = new UIImageView();                     //92 * 233
                    btlImage.Frame = new CGRect(0, 10, width, width);
                    UIImage image = new UIImage("Images/loadin.png");

                    var btnBuy = new UIButton();
                    btnBuy.Frame             = new CGRect(UIScreen.MainScreen.Bounds.Width - 140, 70 + View.Frame.Width, 130, 70);
                    btnBuy.ClipsToBounds     = true;
                    btnBuy.Layer.BorderColor = UIColor.White.CGColor;
                    //btnBuy.Layer.EdgeAntialiasingMask = CAEdgeAntialiasingMask.LeftEdge | CAEdgeAntialiasingMask.RightEdge | CAEdgeAntialiasingMask.BottomEdge | CAEdgeAntialiasingMask.TopEdge;
                    btnBuy.SetImage(UIImage.FromFile("buy.png"), UIControlState.Normal);
                    btnBuy.TouchUpInside += delegate {
                        UIApplication.SharedApplication.OpenUrl(new NSUrl("http://www.wineoutlet.com/sku" + data.SKU + ".html"));
                    };

                    CGRect rect      = btlImage.Bounds;
                    nfloat boxHeight = rect.Height;                     // which is = width;
                    //nfloat imgHeight = image.Size.Height;
                    //nfloat ratio = boxHeight / imgHeight;
                    //CGSize newSize = new CGSize(image.Size.Width * ratio, image.Size.Height * ratio);
                    //image = image.Scale(newSize);
                    nfloat X = (rect.Width / 2) - 50;
                    btlImage.Frame = new CGRect(X, btlImage.Bounds.Height / 2, 100, 100);
                    btlImage.Image = image;
                    DownloadAsync(data.Barcode, _storeId, btlImage, boxHeight, 70);
                    nfloat Y1 = 90 + View.Frame.Width;

                    UITextView txtWineleft = new UITextView(new CGRect(0, Y1 + 10, width, 40));
                    txtWineleft.Text          = "Wine left in bottle: " + data.AvailableVolume.ToString() + ".ml";
                    txtWineleft.TextAlignment = UITextAlignment.Center;
                    txtWineleft.Editable      = false;
                    //uip.SetProgress(Convert.ToSingle(data.AvailableVolume), false);
                    //uip.ProgressTintColor = UIColor.Green;
                    //uip.TintColor = UIColor.Gray;
                    //CGAffineTransform transform=CGAffineTransform.MakeScale(1.0f,Convert.ToSingle(data.AvailableVolume));
                    //uip.Transform = transform;

                    var ratingConfig = new RatingConfig(emptyImage: UIImage.FromBundle("Stars/empty.png"),
                                                        filledImage: UIImage.FromBundle("Stars/star.png"),
                                                        chosenImage: UIImage.FromBundle("Stars/star.png"));

                    nfloat Y = 70 + View.Frame.Width;
                    ratingView = new PDRatingView(new CGRect(width * 3 / 8 + 2, Y, width / 4, 20f), ratingConfig, data.AverageRating);
                    ratingView.UserInteractionEnabled = false;


                    var lblRateTitle = new UILabel();
                    lblRateTitle.Frame         = new CGRect(4, Y + 40, width, 50);
                    lblRateTitle.Text          = "Rate this Wine";
                    lblRateTitle.TextAlignment = UITextAlignment.Center;
                    lblRateTitle.Font          = UIFont.FromName("Verdana-Bold", 16f);
                    lblRateTitle.TextColor     = UIColor.Purple;

                    var lblRateRequest = new UILabel();
                    lblRateRequest.Frame         = new CGRect(4, Y + 75, width, 10);
                    lblRateRequest.Text          = "Select number of Stars";
                    lblRateRequest.Font          = UIFont.FromName("AmericanTypewriter", 10f);
                    lblRateRequest.TextAlignment = UITextAlignment.Center;

                    var starUpLine = new UIImageView(new CGRect(4, Y + 90, width - 8, 1));
                    starUpLine.AutoresizingMask  = UIViewAutoresizing.FlexibleWidth;
                    starUpLine.Image             = UIImage.FromFile("separator.png");
                    starUpLine.ContentMode       = UIViewContentMode.ScaleAspectFill;
                    starUpLine.ClipsToBounds     = true;
                    starUpLine.Layer.BorderColor = UIColor.White.CGColor;
                    starUpLine.BackgroundColor   = UIColor.LightGray;
                    Y = Y + 10;
                    PDRatingView     ratingViewSelect = new PDRatingView(new CGRect(width * 2 / 8, Y + 82, width / 2, 36f), ratingConfig, 0m);
                    UIViewController that             = this;

                    var starDownLine = new UIImageView(new CGRect(4, Y + 120, View.Frame.Width - 8, 1));
                    starDownLine.AutoresizingMask  = UIViewAutoresizing.FlexibleWidth;
                    starDownLine.Image             = UIImage.FromFile("separator.png");
                    starDownLine.ContentMode       = UIViewContentMode.ScaleAspectFill;
                    starDownLine.ClipsToBounds     = true;
                    starDownLine.Layer.BorderColor = UIColor.White.CGColor;
                    starDownLine.BackgroundColor   = UIColor.LightGray;

                    Y = Y + 140;
                    var lblDesc = new UILabel();
                    lblDesc.Frame         = new CGRect(4, Y, View.Frame.Width, 20);
                    lblDesc.Text          = "Description: ";
                    lblDesc.TextAlignment = UITextAlignment.Left;

                    Y = Y + 20;
                    var lblDescText = new UITextView();
                    lblDescText.Editable = false;
                    if (data.Description == null || data.Description == "")
                    {
                        lblDescText.Text = "Not available";
                        lblDescText.Font = UIFont.FromName("EuphemiaUCAS-Italic", 10f);
                    }
                    else
                    {
                        lblDescText.Text = data.Description.Trim();
                    }
                    lblDescText.TextAlignment = UITextAlignment.Justified;
                    CGSize sTemp = new CGSize(width, 100);
                    sTemp             = lblDescText.SizeThatFits(sTemp);
                    lblDescText.Frame = new CGRect(0, Y, width, sTemp.Height);

                    Y = Y + lblDescText.Frame.Size.Height;
                    var table = new UITableView();
                    table.Frame           = new CGRect(0, Y, width, data.WineProperties.Count * 22);
                    table.Source          = new WineInfoTableSource(data.WineProperties);
                    table.AllowsSelection = false;
                    table.ScrollEnabled   = false;

                    Y = Y + table.Frame.Size.Height + 10;
                    var lblProducer = new UILabel();
                    lblProducer.Frame         = new CGRect(4, Y, width, 20);
                    lblProducer.Text          = "Producer: ";
                    lblProducer.TextAlignment = UITextAlignment.Left;

                    Y = Y + 20;
                    var lblProducerText = new UITextView();
                    lblProducerText.Editable = false;
                    if (data.Producer == null || data.Producer == "")
                    {
                        lblProducerText.Text = "Not available";
                        lblProducerText.Font = UIFont.FromName("EuphemiaUCAS-Italic", 10f);
                    }
                    else
                    {
                        lblProducerText.Text = data.Producer.Trim();
                    }
                    lblProducerText.TextAlignment = UITextAlignment.Justified;
                    sTemp = new CGSize(width, 100);
                    sTemp = lblProducerText.SizeThatFits(sTemp);
                    lblProducerText.Frame = new CGRect(0, Y, width, sTemp.Height);


                    ItemReviewResponse ratings = svc.GetItemReviewsByWineID(data.Barcode).Result;
                    data.Reviews = ratings.Reviews.ToList();
                    Y            = Y + lblProducerText.Frame.Size.Height;
                    var review = LoadReviews(data, Y, width);
                    Y = Y + review.Frame.Size.Height;

                    //Y = Y + 20;
                    var NoReviews = new UITextView();
                    NoReviews.Hidden = true;
                    if (data.Reviews.Count == 0)
                    {
                        _noreviews = true;
                        reviewTable.SeparatorColor = UIColor.Clear;
                        NoReviews.Text             = ratings.ErrorDescription;
                        sTemp                   = NoReviews.SizeThatFits(sTemp);
                        NoReviews.Frame         = new CGRect(0, Y - 50, width, 40);
                        NoReviews.Editable      = false;
                        NoReviews.TextAlignment = UITextAlignment.Center;
                        NoReviews.Hidden        = false;
                    }

                    var    currentReview = data.Reviews.Where(x => x.ReviewUserId == CurrentUser.RetreiveUserId()).FirstOrDefault();
                    string currComments  = "";
                    if (currentReview != null)
                    {
                        currComments = currentReview.RatingText;
                    }
                    if (_notif == true)
                    {
                        //ratingViewSelect.RatingChosen += (sender, e) =>
                        //{
                        //if (CurrentUser.RetreiveUserId() == 0)
                        //{
                        //	UIAlertView alert = new UIAlertView()
                        //	{
                        //		Title = "This feature is allowed only for VIP Card holders",
                        //		//Message = "Coming Soon..."
                        //	};
                        //		alert.AddButton("OK");
                        //	alert.AddButton("Know more");
                        //	alert.Clicked += (senderalert, buttonArgs) =>
                        //	{
                        //		if (buttonArgs.ButtonIndex == 1)
                        //		{
                        //			UIApplication.SharedApplication.OpenUrl(new NSUrl("https://hangoutz.azurewebsites.net/index.html"));
                        //		}
                        //	};
                        //	alert.Show();
                        //	ratingViewSelect.ChosenRating = 0;
                        //}
                        //else
                        //{
                        try
                        {
                            LoggingClass.LogInfo("Came from notifications and giving rating for " + data.Barcode, screen);
                            PopupView yourController = new PopupView(data.Barcode, _storeId);
                            yourController.NavController          = NavigationController;
                            yourController.parent                 = that;
                            yourController.StartsSelected         = 5;
                            yourController.Comments               = currComments;
                            yourController.ModalPresentationStyle = UIModalPresentationStyle.OverCurrentContext;
                            that.PresentModalViewController(yourController, false);
                        }
                        catch (Exception exe)
                        {
                            LoggingClass.LogError(exe.Message, screen, exe.StackTrace);
                        }
                        //}
                        //};
                    }
                    ratingViewSelect.RatingChosen += (sender, e) =>
                    {
                        if (CurrentUser.RetreiveUserId() == 0)
                        {
                            UIAlertView alert = new UIAlertView()
                            {
                                Title = "This feature is allowed only for VIP Card holders",
                                //Message = "Coming Soon..."
                            };
                            alert.AddButton("OK");
                            alert.AddButton("Know more");
                            alert.Clicked += (senderalert, buttonArgs) =>
                            {
                                if (buttonArgs.ButtonIndex == 1)
                                {
                                    UIApplication.SharedApplication.OpenUrl(new NSUrl("https://hangoutz.azurewebsites.net/index.html"));
                                }
                            };
                            alert.Show();
                            ratingViewSelect.ChosenRating = 0;
                        }
                        else
                        {
                            LoggingClass.LogInfo("Clicked on stars to give rating on " + data.Barcode, screen);
                            PopupView yourController = new PopupView(data.Barcode, _storeId);
                            yourController.NavController          = NavigationController;
                            yourController.parent                 = that;
                            yourController.StartsSelected         = e.Rating;
                            yourController.Comments               = currComments;
                            yourController.ModalPresentationStyle = UIModalPresentationStyle.OverCurrentContext;
                            that.PresentModalViewController(yourController, false);
                        }
                    };
                    scrollView       = new UIScrollView();
                    scrollView.Frame = new CGRect(0, 70, View.Frame.Width, View.Frame.Height);
                    if (_noreviews == true)
                    {
                        scrollView.ContentSize = new CGSize(View.Frame.Width, Y + 70);
                    }
                    else
                    {
                        scrollView.ContentSize = new CGSize(View.Frame.Width, Y + 20);
                    }
                    if (refresh == true)
                    {
                        //scrollView.ContentSize = new CGSize(UIScreen.MainScreen.Bounds.Width, 70);
                        scrollView.ContentOffset = new CGPoint(0, 300);
                        var tap = new UITapGestureRecognizer {
                            CancelsTouchesInView = false
                        };
                        tap.AddTarget(() =>
                        {
                            scrollView.ContentSize   = new CGSize(View.Frame.Width, Y + 70);
                            scrollView.ContentOffset = new CGPoint(0, 0);
                        });
                    }


                    scrollView.BackgroundColor  = UIColor.White;
                    scrollView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight;
                    //};
                    if (_fav != true)
                    {
                        scrollView.AddSubview(txtWineleft);
                    }
                    //When making it async the Frame.Y is messing up by image Y. So changing it to 70. Ideally it should be 0.
                    //Same will apply to ContentSize.Y
                    View.AddSubview(scrollView);
                    //View.AddSubview(NoReviews);
                    //scrollView.AddSubview(btnBuy);
                    scrollView.AddSubview(lblName);
                    //scrollView.AddSubview(txtWineleft);
                    scrollView.AddSubview(lblVintage);
                    scrollView.AddSubview(btlImage);
                    scrollView.AddSubview(ratingView);
                    scrollView.AddSubview(lblRateTitle);
                    scrollView.AddSubview(lblRateRequest);
                    scrollView.AddSubview(ratingViewSelect);
                    scrollView.AddSubview(starUpLine);
                    scrollView.AddSubview(starDownLine);
                    scrollView.AddSubview(lblDesc);
                    scrollView.AddSubview(lblDescText);
                    scrollView.AddSubview(table);
                    scrollView.AddSubview(lblProducer);
                    scrollView.AddSubview(lblProducerText);
                    scrollView.AddSubview(review);
                    scrollView.AddSubview(NoReviews);
                    //scrollView.
                    BTProgressHUD.Dismiss();
                }
                else
                {
                    BTProgressHUD.Dismiss();
                    UIAlertView alert = new UIAlertView()
                    {
                        Title   = "Sorry",
                        Message = "Something went wrong. We are on it"
                    };

                    alert.AddButton("OK");
                    alert.Show();
                }
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.Message, screen, ex.StackTrace.ToString());
            }
        }
Esempio n. 14
0
        public UIView GetViewForSKUCell(nint index)
        {
            UIView vw = new UIView();

            //UIImage image = new UIImage();
            try
            {
                var ratingConfig = new RatingConfig(emptyImage: UIImage.FromBundle("Stars/empty.png"),
                                                    filledImage: UIImage.FromBundle("Stars/star.png"),
                                                    chosenImage: UIImage.FromBundle("Stars/star.png"));

                switch (index)
                {
                case 1:
                    var lblName = new UILabel();
                    lblName.Frame         = new CGRect(0, 0, this.Width, 40);
                    lblName.Text          = data.Name;
                    lblName.Font          = UIFont.FromName("Verdana-Bold", 16f);
                    lblName.TextAlignment = UITextAlignment.Center;
                    lblName.TextColor     = UIColor.Purple;
                    vw = lblName;
                    break;

                case 2:
                    //vw = Separator;
                    break;

                case 3:
                    var lblVintage = new UILabel();
                    lblVintage.Frame = new CGRect(0, 0, this.Width, 20);
                    double l = Math.Floor(Math.Log10(data.Vintage) + 1);
                    if (l > 4)
                    {
                        lblVintage.Text = "";
                    }
                    else
                    {
                        lblVintage.Text = data.Vintage.ToString();
                    }
                    lblVintage.Font            = UIFont.FromName("Verdana", 12f);
                    lblVintage.TextAlignment   = UITextAlignment.Center;
                    lblVintage.BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile("line123.png"));
                    vw = lblVintage;
                    //vw.AddSubview(Separator);
                    break;

                case 4:
                    var btlBack = new UIImageView();
                    btlBack.Frame = new CGRect(0, 10, this.Width, this.Width);
                    btlBack.Image = UIImage.FromFile("Wines/bottle.jpg");
                    btlImage      = new UIImageView();

                    //UIImage image = BlobWrapper.GetImageBitmapFromWineId(data.WineId.ToString(),_store.ToString());
                    UIImage image = new UIImage("Images/loadin.png");


                    if (image != null)
                    {
                        CGRect rect      = btlBack.Bounds;
                        nfloat boxHeight = rect.Height;                                 // which is = width;
                        nfloat imgHeight = image.Size.Height;
                        nfloat ratio     = boxHeight / imgHeight;
                        CGSize newSize   = new CGSize(image.Size.Width * ratio, image.Size.Height * ratio);
                        image = image.Scale(newSize);
                        nfloat X = (boxHeight - image.Size.Width) / 2;
                        btlImage.Frame = new CGRect(X, 0, image.Size.Width, image.Size.Height);
                        nfloat wid = this.Width;
                        nfloat hei = this.Width;
                        btlImage.Image = image;
                        DownloadAsync(data.Barcode, _store, btlImage, boxHeight);
                    }
                    else
                    {
                        btlImage.Image = new UIImage("Wines/bottle.jpg");
                    }
                    vw = btlImage;

                    break;

                case 5:
                    ratingView = new PDRatingView(new CGRect(this.Width * 3 / 8 + 2, 10, this.Width / 4, 20f), ratingConfig, data.AverageRating);
                    ratingView.UserInteractionEnabled = false;
                    vw = ratingView;
                    break;

                case 6:
                    var lblRateTitle = new UILabel();
                    lblRateTitle.Frame         = new CGRect(4, 10, this.Width, 50);
                    lblRateTitle.Text          = "Rate this Wine";
                    lblRateTitle.TextAlignment = UITextAlignment.Center;
                    lblRateTitle.Font          = UIFont.FromName("Verdana-Bold", 16f);
                    lblRateTitle.TextColor     = UIColor.Purple;
                    vw = lblRateTitle;
                    break;

                case 7:
                    var lblRateRequest = new UILabel();
                    lblRateRequest.Frame         = new CGRect(4, 0, this.Width, 10);
                    lblRateRequest.Text          = "Select number of Stars";
                    lblRateRequest.Font          = UIFont.FromName("AmericanTypewriter", 10f);
                    lblRateRequest.TextAlignment = UITextAlignment.Center;
                    vw = lblRateRequest;
                    break;

                case 8:
                    var starUpLine = new UIImageView(new CGRect(4, 0, this.Width - 8, 1));
                    starUpLine.AutoresizingMask  = UIViewAutoresizing.FlexibleWidth;
                    starUpLine.Image             = UIImage.FromFile("separator.png");
                    starUpLine.ContentMode       = UIViewContentMode.ScaleAspectFill;
                    starUpLine.ClipsToBounds     = true;
                    starUpLine.Layer.BorderColor = UIColor.White.CGColor;
                    starUpLine.BackgroundColor   = UIColor.LightGray;
                    vw = starUpLine;
                    break;

                case 9:
                    PDRatingView ratingView2 = new PDRatingView(new CGRect(this.Width * 2 / 8, 0, this.Width / 2, 36f), ratingConfig, 0m);
                    // [Optional] Do something when the user selects a rating.
                    UIViewController that = Parent;

                    ratingView2.RatingChosen += (sender, e) =>
                    {
                        if (CurrentUser.RetreiveUserId() == 0)
                        {
                            UIAlertView alert = new UIAlertView()
                            {
                                Title = "This feature is allowed only for VIP Card holders",
                                //Message = "Coming Soon..."
                            };
                            //LoggingClass.LogInfo("Clicked on seacuces", screenid);
                            alert.AddButton("OK");
                            alert.AddButton("Know more");
                            alert.Clicked += (senderalert, buttonArgs) =>
                            {
                                if (buttonArgs.ButtonIndex == 1)
                                {
                                    UIApplication.SharedApplication.OpenUrl(new NSUrl("https://hangoutz.azurewebsites.net/index.html"));
                                }
                            };
                            alert.Show();
                            ratingView2.ChosenRating = 0;
                        }
                        else
                        {
                            LoggingClass.LogInfo("Clicked on stars to give rating on " + data.Barcode, screenid);
                            PopupView yourController = new PopupView(data.Barcode, _store);
                            yourController.NavController          = NavigationController;
                            yourController.parent                 = that;
                            yourController.StartsSelected         = e.Rating;
                            yourController.ModalPresentationStyle = UIModalPresentationStyle.OverCurrentContext;
                            that.PresentModalViewController(yourController, false);
                        }
                        //ShowModal(false);
                    };
                    vw = ratingView2;
                    break;

                case 10:
                    var starDownLine = new UIImageView(new CGRect(4, 10, this.Width - 8, 1));
                    starDownLine.AutoresizingMask  = UIViewAutoresizing.FlexibleWidth;
                    starDownLine.Image             = UIImage.FromFile("separator.png");
                    starDownLine.ContentMode       = UIViewContentMode.ScaleAspectFill;
                    starDownLine.ClipsToBounds     = true;
                    starDownLine.Layer.BorderColor = UIColor.White.CGColor;
                    starDownLine.BackgroundColor   = UIColor.LightGray;
                    vw = starDownLine;
                    break;

                case 11:
                    var lblDesc = new UILabel();
                    lblDesc.Frame         = new CGRect(4, 10, this.Width, 20);
                    lblDesc.Text          = "Description: ";
                    lblDesc.TextAlignment = UITextAlignment.Left;
                    vw = lblDesc;
                    break;

                case 12:
                    var lblDescText = new UITextView();
                    lblDescText.Editable = false;
                    if (data.Description == null || data.Description == "")
                    {
                        lblDescText.Text = "Not available";
                    }
                    else
                    {
                        lblDescText.Text = data.Description;
                    }
                    lblDescText.TextAlignment = UITextAlignment.Justified;
                    //lblDescText.BackgroundColor = UIColor.LightGray;
                    CGSize sTemp = new CGSize(this.Width, 100);
                    sTemp             = lblDescText.SizeThatFits(sTemp);
                    lblDescText.Frame = new CGRect(0, 0, this.Width, sTemp.Height);
                    vw = lblDescText;
                    break;

                case 13:
                    table = new UITableView();
                    //string[,] tableItems
                    table.Frame           = new CGRect(0, 0, this.Width, data.WineProperties.Count * 22);
                    table.Source          = new WineInfoTableSource(data.WineProperties);
                    table.AllowsSelection = false;
                    table.ScrollEnabled   = false;
                    vw = table;
                    break;

                case 14:
                    var lblProducer = new UILabel();
                    lblProducer.Frame         = new CGRect(4, 10, this.Width, 20);
                    lblProducer.Text          = "Producer: ";
                    lblProducer.TextAlignment = UITextAlignment.Left;
                    vw = lblProducer;
                    break;

                case 15:
                    var lblProducerText = new UITextView();
                    lblProducerText.Editable = false;
                    //lblProducerText.Frame = new CGRect(0, 0, this.Width, 100);
                    if (data.Producer == null || data.Producer == "")
                    {
                        lblProducerText.Text = "Not available";
                    }
                    else
                    {
                        lblProducerText.Text = data.Producer;
                    }
                    lblProducerText.TextAlignment = UITextAlignment.Justified;
                    //lblProducerText.BackgroundColor = UIColor.LightGray;
                    sTemp = new CGSize(this.Width, 100);
                    sTemp = lblProducerText.SizeThatFits(sTemp);
                    lblProducerText.Frame = new CGRect(0, 0, this.Width, sTemp.Height);
                    vw = lblProducerText;
                    break;

                case 16:
                    vw = LoadReviews();
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screenid, ex.StackTrace);
            }
            return(vw);
        }
        public APLCollectionViewCell(CGRect frame) : base(frame)
        {
            CGRect box = new CGRect(Bounds.Location, Bounds.Size);

            box.X                                = 0;
            box.Y                                = 0;
            box.Height                           = box.Height - 150;
            BackgroundColor                      = UIColor.DarkGray;
            ImageView                            = new UIButton(box);
            ImageView.AutoresizingMask           = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
            ImageView.ContentMode                = UIViewContentMode.ScaleAspectFill;
            ImageView.Layer.BorderWidth          = 3.0f;
            ImageView.ClipsToBounds              = true;
            ImageView.Layer.BorderColor          = UIColor.White.CGColor;
            ImageView.Layer.EdgeAntialiasingMask = CAEdgeAntialiasingMask.LeftEdge | CAEdgeAntialiasingMask.RightEdge | CAEdgeAntialiasingMask.BottomEdge | CAEdgeAntialiasingMask.TopEdge;
            ImageView.SetBackgroundImage(UIImage.FromFile("placeholder.jpeg"), UIControlState.Normal);

            ImageView.TouchUpInside += (object sender, EventArgs e) =>
            {
                NavigationController.PushViewController(new DetailViewController(), false);
            };


            box.Width = (box.Width / 240) * 92;            //box.Width / 2;
            box.X     = (Bounds.Width - box.Width) / 2;
            btlImage  = new UIButton(box);
            btlImage.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
            btlImage.ContentMode      = UIViewContentMode.ScaleToFill;
            //btlImage.Layer.BorderWidth = 3.0f;
            btlImage.ClipsToBounds              = true;
            btlImage.Layer.BorderColor          = UIColor.White.CGColor;
            btlImage.Layer.EdgeAntialiasingMask = CAEdgeAntialiasingMask.LeftEdge | CAEdgeAntialiasingMask.RightEdge | CAEdgeAntialiasingMask.BottomEdge | CAEdgeAntialiasingMask.TopEdge;
            //btlImage.SetBackgroundImage(UIImage.FromFile("Honoro g.png"), UIControlState.Normal);
            //btlImage.InsertSubviewAbove()
            btlImage.TouchUpInside += (object sender, EventArgs e) =>
            {
                NavigationController.PushViewController(new DetailViewController(), false);
            };

            box.Height = 20;
            box.Width  = 20;
            box.X      = (Bounds.Width - 25);
            box.Y      = 5;
            heartImage = new UIButton(box);
            //heartImage.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
            //heartImage.ContentMode = UIViewContentMode.ScaleToFill;
            heartImage.ClipsToBounds = true;
            //heartImage.Layer.BorderWidth = 3.0f;
            heartImage.Layer.BorderColor          = UIColor.White.CGColor;
            heartImage.Layer.EdgeAntialiasingMask = CAEdgeAntialiasingMask.LeftEdge | CAEdgeAntialiasingMask.RightEdge | CAEdgeAntialiasingMask.BottomEdge | CAEdgeAntialiasingMask.TopEdge;
            heartImage.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
            heartImage.Tag = 0;             // Empty;

            heartImage.TouchUpInside += (object sender, EventArgs e) =>
            {
                //Do some actionn
                UIButton temp = (UIButton)sender;
                if (temp.Tag == 0)
                {
                    heartImage.SetImage(UIImage.FromFile("heart_full.png"), UIControlState.Normal);
                    temp.Tag = 1;
                }
                else
                {
                    heartImage.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                    temp.Tag = 0;
                }
                //NavigationController.PushViewController(new DetailViewController(), false);
            };

            CGRect lower = new CGRect(Bounds.Location, Bounds.Size);

            lower.Y               = 35; //lower.Y + (ratio)*(Bounds.Height);
            lblName               = new UILabel(lower);
            lblName.Text          = "Wine Name";
            lblName.TextAlignment = UITextAlignment.Center;

            lower.Y      = 225;
            lower.Height = 1;
            lower.Width  = lower.Width - 20;
            lower.X      = lower.X + 10;

            Separator = new UIImageView(lower);
            Separator.AutoresizingMask  = UIViewAutoresizing.FlexibleWidth;
            Separator.Image             = UIImage.FromFile("separator.png");
            Separator.ContentMode       = UIViewContentMode.ScaleAspectFill;
            Separator.ClipsToBounds     = true;
            Separator.Layer.BorderColor = UIColor.White.CGColor;
            Separator.BackgroundColor   = UIColor.LightGray;

            CGRect year = new CGRect(Bounds.Location, Bounds.Size);

            year.Y                  = lower.Y - 15;
            year.X                  = year.Width / 2 - 25;
            year.Height             = 30;
            year.Width              = 50;
            lblYear                 = new UILabel(year);
            lblYear.Text            = "2012";
            lblYear.TextAlignment   = UITextAlignment.Center;
            lblYear.BackgroundColor = UIColor.DarkGray;


            lblRegPrice               = new UILabel(new CGRect(0, Bounds.Height - 60, Bounds.Width, 12f));
            lblRegPrice.Text          = "$9.99";
            lblRegPrice.Font          = UIFont.FromName("Verdana", 13f);
            lblRegPrice.TextAlignment = UITextAlignment.Center;

            var ratingConfig = new RatingConfig(emptyImage: UIImage.FromBundle("Stars/empty.png"),
                                                filledImage: UIImage.FromBundle("Stars/filled.png"),
                                                chosenImage: UIImage.FromBundle("Stars/chosen.png"));

            decimal averageRating = 0;

            ratingView = new PDRatingView(new CGRect(Bounds.Width * 1 / 4, Bounds.Height - 40, Bounds.Width / 2, 14f), ratingConfig, averageRating);
            ratingView.UserInteractionEnabled = false;
            //ratingView.BackgroundColor = UIColor.White;

            ContentView.AddSubview(ImageView);
            ContentView.InsertSubviewAbove(btlImage, ImageView);
            //ContentView.AddSubview(btlImage);
            ContentView.AddSubview(heartImage);
            ContentView.AddSubview(lblName);
            ContentView.AddSubview(Separator);
            ContentView.AddSubview(lblYear);
            ContentView.AddSubview(lblRegPrice);
            ContentView.AddSubview(ratingView);
        }
        public MyReviewCellView(NSString cellId) : base(UITableViewCellStyle.Default, cellId)
        {
            try
            {
                btnBack = new UIButton();
                btnBack.BackgroundColor        = UIColor.FromRGB(63, 63, 63);
                btnBack.UserInteractionEnabled = false;
                SelectionStyle             = UITableViewCellSelectionStyle.Gray;
                imageView                  = new UIButton();
                imageView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
                imageView.ContentMode      = UIViewContentMode.Center;
                imageView.ClipsToBounds    = true;
                //imageView.TouchDown += (object sender, EventArgs e) =>
                //{
                //	BTProgressHUD.Show("Loading...");
                //};
                imageView.TouchUpInside += (object sender, EventArgs e) =>
                {
                    BTProgressHUD.Show(LoggingClass.txtloading);
                    NavController.PushViewController(new DetailViewController(WineIdLabel.Text, storeid.ToString(), false, true), false);
                };
                Review review = new Review();
                separator = new UIImageView();

                btnItemname = new UIButton();
                btnItemname.SetTitle("", UIControlState.Normal);
                btnItemname.SetTitleColor(UIColor.FromRGB(127, 51, 0), UIControlState.Normal);
                btnItemname.Font                = UIFont.FromName("Verdana-Bold", 13f);
                btnItemname.LineBreakMode       = UILineBreakMode.WordWrap;
                btnItemname.HorizontalAlignment = UIControlContentHorizontalAlignment.Left;
                btnItemname.TouchUpInside      += delegate
                {
                    BTProgressHUD.Show("Loading...");
                    NavController.PushViewController(new DetailViewController(WineIdLabel.Text, storeid.ToString(), false, true), false);
                };
                ReviewDate = new UILabel()
                {
                    Font      = UIFont.FromName("AmericanTypewriter", 10f),
                    TextColor = UIColor.FromRGB(38, 127, 200),
                    //TextAlignment = UITextAlignment.Center,
                    BackgroundColor = UIColor.Clear
                };
                Comments = new UITextView()
                {
                    Font          = UIFont.FromName("AmericanTypewriter", 14f),
                    TextColor     = UIColor.FromRGB(55, 127, 0),
                    TextAlignment = UITextAlignment.Justified,
                    //TextAlignment = UITextAlignment.Natural,
                    BackgroundColor = UIColor.Clear,
                    //LineBreakMode = UILineBreakMode.WordWrap
                    Editable   = false,
                    Selectable = false
                };
                ReadMore = new UIButton()
                {
                    Font            = UIFont.FromName("Verdana", 10f),
                    BackgroundColor = UIColor.White
                };
                Vintage = new UILabel()
                {
                    Font            = UIFont.FromName("Verdana", 10f),
                    TextColor       = UIColor.FromRGB(127, 51, 100),
                    BackgroundColor = UIColor.Clear
                };
                decimal averageRating = 0.0m;
                var     ratingConfig  = new RatingConfig(emptyImage: UIImage.FromBundle("Stars/star-silver2.png"),
                                                         filledImage: UIImage.FromBundle("Stars/star.png"),
                                                         chosenImage: UIImage.FromBundle("Stars/star.png"));
                stars   = new PDRatingView(new CGRect(110, 60, 60, 20), ratingConfig, averageRating);
                btnEdit = new UIButton();
                btnEdit.SetImage(UIImage.FromFile("edit.png"), UIControlState.Normal);
                btnEdit.TouchUpInside += (sender, e) =>
                {
                    PopupView yourController = new PopupView(WineIdLabel.Text, storeid);
                    yourController.NavController  = NavController;
                    yourController.parent         = Parent;
                    yourController.StartsSelected = stars.AverageRating;
                    yourController.Comments       = Comments.Text;
                    LoggingClass.LogInfo("Edited the review of " + wineId, screenid);


                    //yourController.WineId = Convert.ToInt32(WineIdLabel.Text);
                    yourController.ModalPresentationStyle = UIModalPresentationStyle.OverCurrentContext;
                    //this.PresentViewController(yourController, true, null);
                    Parent.PresentModalViewController(yourController, false);
                };
                btnDelete = new UIButton();
                btnDelete.SetImage(UIImage.FromFile("delete.png"), UIControlState.Normal);
                btnDelete.TouchUpInside += (sender, e) =>
                {
                    UIAlertView alert = new UIAlertView()
                    {
                        Title   = "Delete Review ",
                        Message = LoggingClass.txtdeletereview,
                    };
                    alert.AddButton("Yes");
                    alert.AddButton("No");

                    alert.Clicked += async(senderalert, buttonArgs) =>
                    {
                        if (buttonArgs.ButtonIndex == 0)
                        {
                            review.Barcode      = WineIdLabel.Text;
                            review.ReviewUserId = Convert.ToInt32(CurrentUser.RetreiveUserId());
                            BTProgressHUD.Show("Deleting review");
                            await sw.DeleteReview(review);

                            LoggingClass.LogInfo("Deleting the review of " + wineId, screenid);
                            BTProgressHUD.ShowSuccessWithStatus("Done");
                            ((IPopupParent)Parent).RefreshParent();
                        }
                    };

                    alert.Show();
                };
                btnLike = new UIButton();
                btnLike.ClipsToBounds              = true;
                btnLike.Layer.BorderColor          = UIColor.White.CGColor;
                btnLike.Layer.EdgeAntialiasingMask = CAEdgeAntialiasingMask.LeftEdge | CAEdgeAntialiasingMask.RightEdge | CAEdgeAntialiasingMask.BottomEdge | CAEdgeAntialiasingMask.TopEdge;
                btnLike.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                btnLike.Tag = 0;
                //myItem = new Item();
                //bool count =Convert.ToBoolean( myItem.IsLike);
                //if (count == true)
                //{
                //btnLike.SetImage(UIImage.FromFile("heart_full.png"), UIControlState.Normal);}
                //else
                //{
                //	btnLike.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                //}
                btnLike.TouchUpInside += async(object sender, EventArgs e) =>
                {
                    try
                    {
                        UIButton temp = (UIButton)sender;
                        if (temp.Tag == 0)
                        {
                            btnLike.SetImage(UIImage.FromFile("heart_full.png"), UIControlState.Normal);
                            temp.Tag   = 1;
                            Data.Liked = 1;
                            //btnLike.Tag = 1;
                            LoggingClass.LogInfo("Liked Wine " + WineIdLabel.Text, screenid);
                        }
                        else
                        {
                            btnLike.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                            temp.Tag   = 0;
                            Data.Liked = 0;

                            LoggingClass.LogInfo("Unliked Wine " + WineIdLabel.Text, screenid);
                        }
                        SKULike like = new SKULike();
                        like.UserID  = Convert.ToInt32(CurrentUser.RetreiveUserId());
                        like.BarCode = WineIdLabel.Text;
                        like.Liked   = Convert.ToBoolean(temp.Tag);

                        Data.Liked = Convert.ToInt32(temp.Tag);
                        await sw.InsertUpdateLike(like);
                    }
                    catch (Exception ex)
                    {
                        LoggingClass.LogError(ex.Message, screenid, ex.StackTrace);
                    }
                };
                WineIdLabel = new UILabel();
                ContentView.AddSubviews(new UIView[] { btnBack, btnItemname, ReadMore, ReviewDate, Comments, stars, imageView, Vintage, separator, btnEdit, btnDelete, btnLike });
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screenid, ex.StackTrace);
            }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            nfloat h = View.Frame.Height * 2.3f;
            nfloat w = UIScreen.MainScreen.Bounds.Width;

            scrollView = new UIScrollView
            {
                Frame            = new CGRect(0, 20, View.Frame.Width, View.Frame.Height),
                ContentSize      = new CGSize(View.Frame.Width, h),
                BackgroundColor  = UIColor.LightGray,
                AutoresizingMask = UIViewAutoresizing.FlexibleHeight
            };

            var lblName = new UILabel();

            lblName.Frame         = new CGRect(0, 0, View.Frame.Width, 20);
            lblName.Text          = "Arzenton Pinot Nero";
            lblName.TextAlignment = UITextAlignment.Center;
            scrollView.AddSubview(lblName);

            var Separator = new UIImageView();

            Separator.Frame = new CGRect(0, 50, View.Frame.Width, 2);
            Separator.Image = UIImage.FromFile("separator.png");
            scrollView.AddSubview(Separator);

            var lblVintage = new UILabel();

            lblVintage.Frame           = new CGRect(View.Frame.Width / 2 - 10, 40, 40, 20);
            lblVintage.Text            = "2013";
            lblVintage.TextAlignment   = UITextAlignment.Center;
            lblVintage.BackgroundColor = UIColor.LightGray;
            scrollView.AddSubview(lblVintage);

            var btlBack = new UIImageView();

            btlBack.Frame = new CGRect(0, 70, View.Frame.Width, View.Frame.Width);
            btlBack.Image = UIImage.FromFile("placeholder.jpeg");
            scrollView.AddSubview(btlBack);

            nfloat height   = View.Frame.Width - 20;
            nfloat width    = (height / 233) * 92;
            nfloat X        = (View.Frame.Width - width) / 2;
            var    btlImage = new UIImageView();          //92 * 233

            btlImage.Frame = new CGRect(X, 90, width, height);
            btlImage.Image = UIImage.FromFile("Wines/wine2.png");
            scrollView.AddSubview(btlImage);

            var ratingConfig = new RatingConfig(emptyImage: UIImage.FromBundle("Stars/empty.png"),
                                                filledImage: UIImage.FromBundle("Stars/filled.png"),
                                                chosenImage: UIImage.FromBundle("Stars/chosen.png"));

            nfloat Y = 70 + View.Frame.Width;
            // Create the view.
            decimal averageRating = 3.25m;

            ratingView = new PDRatingView(new CGRect(View.Bounds.Width * 3 / 8, Y, View.Bounds.Width / 4, 25f), ratingConfig, averageRating);
            ratingView.UserInteractionEnabled = false;

            scrollView.AddSubview(ratingView);

            var lblRateTitle = new UILabel();

            lblRateTitle.Frame         = new CGRect(4, Y + 40, View.Frame.Width, 20);
            lblRateTitle.Text          = "Rate this Wine";
            lblRateTitle.TextAlignment = UITextAlignment.Center;
            scrollView.AddSubview(lblRateTitle);

            var lblRateRequest = new UILabel();

            lblRateRequest.Frame         = new CGRect(4, Y + 60, View.Frame.Width, 20);
            lblRateRequest.Text          = "Select number of Stars";
            lblRateRequest.Font          = UIFont.FromName("AmericanTypewriter", 10f);
            lblRateRequest.TextAlignment = UITextAlignment.Center;
            scrollView.AddSubview(lblRateRequest);

            ratingView = new PDRatingView(new CGRect(View.Bounds.Width * 2 / 8, Y + 82, View.Bounds.Width / 2, 36f), ratingConfig, 0m);
            // [Optional] Do something when the user selects a rating.
            ratingView.RatingChosen += (sender, e) =>
            {
                //(new UIAlertView("Rated!", e.Rating.ToString() + " stars", null, "Ok")).Show();
                PopupView yourController = new PopupView();

                yourController.ModalPresentationStyle = UIModalPresentationStyle.OverCurrentContext;
                //this.PresentViewController(yourController, true, null);
                this.PresentModalViewController(yourController, false);

                //ShowModal(false);
            };
            scrollView.AddSubview(ratingView);

            var starUpLine = new UIImageView(new CGRect(4, Y + 80, View.Frame.Width - 8, 1));

            starUpLine.AutoresizingMask  = UIViewAutoresizing.FlexibleWidth;
            starUpLine.Image             = UIImage.FromFile("separator.png");
            starUpLine.ContentMode       = UIViewContentMode.ScaleAspectFill;
            starUpLine.ClipsToBounds     = true;
            starUpLine.Layer.BorderColor = UIColor.White.CGColor;
            starUpLine.BackgroundColor   = UIColor.LightGray;
            scrollView.AddSubview(starUpLine);


            var starDownLine = new UIImageView(new CGRect(4, Y + 120, View.Frame.Width - 8, 1));

            starDownLine.AutoresizingMask  = UIViewAutoresizing.FlexibleWidth;
            starDownLine.Image             = UIImage.FromFile("separator.png");
            starDownLine.ContentMode       = UIViewContentMode.ScaleAspectFill;
            starDownLine.ClipsToBounds     = true;
            starDownLine.Layer.BorderColor = UIColor.White.CGColor;
            starDownLine.BackgroundColor   = UIColor.LightGray;
            scrollView.AddSubview(starDownLine);

            Y = Y + 140;
            var lblDesc = new UILabel();

            lblDesc.Frame         = new CGRect(4, Y, View.Frame.Width, 20);
            lblDesc.Text          = "Description: ";
            lblDesc.TextAlignment = UITextAlignment.Left;
            scrollView.AddSubview(lblDesc);

            var lblDescText = new UITextView();

            lblDescText.Frame           = new CGRect(0, Y + 40, View.Frame.Width, 100);
            lblDescText.Text            = "Deep ruby. Perfumes alive and intense of red berry fruit enveloped by fresh spiciness of black pepper, cloves with a finish of cinnamon stick and sensations resinous toasted. In the background, flavors of wild berries. Tannnin vibrant, but already silky and enveloping connotes tasting soft, round but at the same time fresh with a tasty thin vein of great elegance.";
            lblDescText.TextAlignment   = UITextAlignment.Justified;
            lblDescText.BackgroundColor = UIColor.LightGray;
            scrollView.AddSubview(lblDescText);


            var table = new UITableView();

            string[,] tableItems = new string[, ] {
                { "Name", "Arzenton Pinot Nero" }, { "Classification", "Friuli Colli Orientali DOC" }, { "Grape Type:", "Pinot Nero" }, { "Alchol", "13.5%" }, { "Vintage year", "2012" }, { "Aromas", "Red fruits" }, { "Food pairings", "White Meat" }, { "Bottle size", "750ml" }, { "Serving at:", "15 °C" }
            };
            table.Frame           = new CGRect(0, Y + 140, View.Frame.Width, tableItems.Length * 22);
            table.Source          = new WineInfoTableSource(tableItems);
            table.AllowsSelection = false;
            scrollView.AddSubview(table);

            Y = Y + 160 + tableItems.Length * 22;
            var lblProducer = new UILabel();

            lblProducer.Frame         = new CGRect(4, Y, View.Frame.Width, 20);
            lblProducer.Text          = "Producer: ";
            lblProducer.TextAlignment = UITextAlignment.Left;
            scrollView.AddSubview(lblProducer);

            var lblProducerText = new UITextView();

            lblProducerText.Frame           = new CGRect(0, Y + 40, View.Frame.Width, 100);
            lblProducerText.Text            = "Arzenton company was found in 1968, with the accomodation of the hilly area of spessa of Cividale del Friuli: thus in one of the places most suited to vityculture of the capital Doc Coli Orientali bel Friuli. The company consist of 14 hectare of which 10 are devoted to vineyards in soil consist of alternating layers of marl and sandstones that represnt the best soil of viticulture hilly.";
            lblProducerText.TextAlignment   = UITextAlignment.Justified;
            lblProducerText.BackgroundColor = UIColor.LightGray;
            scrollView.AddSubview(lblProducerText);

            scrollView.AddSubview(LoadReviews());

            View.AddSubview(scrollView);
        }