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 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 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()); } }
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); }