コード例 #1
0
        public void UpdateCell(Review review)
        {
            try
            {
                string url = review.SmallImageURL;
                if (url == null)
                {
                    url = review.Barcode + ".jpg";
                }
                imageView.SetImage(BlobWrapper.GetResizedImage(url, new CGRect(0, 0, 100, 155), review.PlantFinal), UIControlState.Normal);
                separator.Image = UIImage.FromFile("separator.png");
                if (review.Vintage.Length < 4)
                {
                    btnItemname.SetTitle(review.Name + " ", UIControlState.Normal);
                }
                else
                {
                    btnItemname.SetTitle(review.Name + " " + review.Vintage, UIControlState.Normal);
                }
                ReviewDate.Text = review.Date.ToString("MM-dd-yyyy");
                Comments.Text   = review.RatingText;
                if (review.RatingText.Length > 97)
                {
                    ReadMore.Frame          = new CGRect(ContentView.Bounds.Width - 25, 160, 70, 25);
                    ReadMore.TouchUpInside += delegate {
                        UIAlertView alert = new UIAlertView()
                        {
                            Title = review.RatingText,
                            //Message = "Coming Soon..."
                        };

                        alert.AddButton("OK");
                        alert.Show();
                    };
                }
                if (review.Liked == 1)
                {
                    btnLike.SetImage(UIImage.FromFile("heart_full.png"), UIControlState.Normal);
                    //btnLike.TouchUpInside +=async delegate {
                    //	btnLike.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                    //		SKULike like = new SKULike();
                    //		like.UserID = Convert.ToInt32(CurrentUser.RetreiveUserId());
                    //		like.BarCode = WineIdLabel.Text;
                    //		like.Liked = Convert.ToBoolean(0);
                    //		myItem.IsLike = Convert.ToBoolean(0);
                    //		await sw.InsertUpdateLike(like);
                    //};
                    btnLike.Tag = 1;
                }
                else
                {
                    btnLike.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                    btnLike.Tag = 0;
                }
                //if (review.  == true)
                //	{
                //		heartImage.SetImage(UIImage.FromFile("heart_full.png"), UIControlState.Normal);
                //	}
                //CGSize sTemp = new CGSize(ContentView.Frame.Width, 100);
                //sTemp = Comments.SizeThatFits(sTemp);
                //if (review.RatingText.Length > 100)
                //{
                //	//ContentView.AddSubview(ReadMore);
                //	ReadMore.TouchUpInside += delegate {
                //		{
                //			UIAlertView alert = new UIAlertView()
                //			{
                //				Title = review.RatingText,
                //				//Message = "Coming Soon..."
                //			};

                //			alert.AddButton("OK");
                //			alert.Show();
                //		};
                //	};
                //	//ReadMore.Hidden = false;
                //}
                //Vintage.Text = " ";//"Vintage:"+review.Vintage.ToString();
                storeid          = Convert.ToInt32(review.PlantFinal);
                WineIdLabel.Text = review.Barcode.ToString();
                ReadMore.SetTitle("... Read More", UIControlState.Normal);
                ReadMore.SetTitleColor(UIColor.Black, UIControlState.Normal);
                ReadMore.BackgroundColor = UIColor.White;
                stars.AverageRating      = Convert.ToDecimal(review.RatingStars);
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screenid, ex.StackTrace);
            }
        }
コード例 #2
0
        public void BindData(MyFavViewCell cell, NSIndexPath indexPath)
        {
            try
            {
                cell.NavigationController = NavigationController;
                //cell.btlImage.SetBackgroundImage(UIImage.FromFile("Wines/wine" + indexPath.Item % 8 + ".png"), UIControlState.Normal);
                cell.parent = this.View;


                int index = (int)indexPath.Item;

                //Data from Model
                //cell.WineName = myData.ItemList[index].Name;
                //cell.AmountLeft.SetProgress(Convert.ToSingle(myData.ItemList[index].AvailableVolume),true);
                double l = Math.Floor(Math.Log10(myData.ItemList[index].Vintage) + 1);
                if (l < 4)
                {
                    cell.lblYear.Text = " ";
                }
                else
                {
                    cell.lblYear.Text = myData.ItemList[index].Vintage.ToString();
                }
                cell.RegPrice      = myData.ItemList[index].SalePrice.ToString();
                cell.averageRating = (decimal)myData.ItemList[index].AverageRating;
                cell.lblName.Text  = myData.ItemList[index].Name;
                //cell.lblYear.Text = myData.ItemList[index].Vintage.ToString();
                cell.lblRegPrice.Text         = myData.ItemList[index].SalePrice.ToString("C", Cultures.UnitedState);
                cell.ratingView.AverageRating = (decimal)myData.ItemList[index].AverageRating;
                cell.myItem      = myData.ItemList[index];
                cell.WineBarcode = myData.ItemList[index].Barcode;
                cell.btnItemname.SetTitle(myData.ItemList[index].Name, UIControlState.Normal);
                if (myData.ItemList[index].IsLike == true)
                {
                    cell.heartImage.SetImage(UIImage.FromFile("heart_full.png"), UIControlState.Normal);
                }
                else
                {
                    cell.heartImage.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                }
                string url = myData.ItemList[index].SmallImageUrl;
                if (url == null)
                {
                    url = myData.ItemList[index].Barcode + ".jpg";
                }
                //UIImage image = BlobWrapper.GetImageBitmapFromWineId(myData.ItemList[index].WineId.ToString());
                UIImage image = BlobWrapper.GetResizedImage(url, cell.btlImage.Bounds, cell.storeId.ToString());
                if (image != null)
                {
                    cell.btlImage.SetImage(image, UIControlState.Normal);
                }
                else
                {
                    cell.btlImage.SetImage(img, UIControlState.Normal);
                }
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.Message, screen, ex.StackTrace.ToString());
                UIAlertView alert = new UIAlertView()
                {
                    Title = "Something went wrong. We are on it."
                            //Message = "Coming Soon..."
                };

                alert.AddButton("OK");
                alert.Show();
            }
        }
コード例 #3
0
        public void UpdateCell(Tastings tasting)
        {
            try
            {
                string url = tasting.SmallImageUrl;
                if (url == null)
                {
                    url = tasting.Barcode + ".jpg";
                }
                imageView.SetImage(BlobWrapper.GetResizedImage(url, new CGRect(0, 0, 100, 155), tasting.PlantFinal.ToString()), UIControlState.Normal);
                separator.Image = UIImage.FromFile("separator.png");
                WineName.Text   = tasting.Name;
                ReviewDate.Text = "Tasted on :" + tasting.TastingDate.ToString("MM-dd-yyyy");
                double l = Math.Floor(Math.Log10(tasting.Vintage) + 1);
                if (l < 4)
                {
                    Vintage.Text = " ";
                }
                else
                {
                    Vintage.Text = tasting.Vintage.ToString();
                }
                if (tasting.PlantFinal == 1)
                {
                    location.Text = "Tasted at : " + LoggingClass.txtstore1;
                }
                else
                {
                    location.Text = "Tasted at : " + LoggingClass.txtstore2;
                }
                WineIdLabel.Text = tasting.Barcode;
                btnItemname.SetTitle(tasting.Name, UIControlState.Normal);
                btnItemname.LineBreakMode       = UILineBreakMode.WordWrap;
                btnItemname.HorizontalAlignment = UIControlContentHorizontalAlignment.Left;
                storeid = tasting.PlantFinal;
                if (tasting.IsLike == true)
                {
                    heartImage.SetImage(UIImage.FromFile("heart_full.png"), UIControlState.Normal);
//						heartImage.TouchUpInside +=async delegate {
//						heartImage.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
//							SKULike like = new SKULike();
//							like.UserID = Convert.ToInt32(CurrentUser.RetreiveUserId());
//							like.BarCode = WineIdLabel.Text;
//							like.Liked = Convert.ToBoolean(0);
//							myItem.IsLike = Convert.ToBoolean(0);
//							ServiceWrapper sw = new ServiceWrapper();
//							await sw.InsertUpdateLike(like);
//					};
                }
                else
                {
                    heartImage.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                }
            }
            catch (Exception ex)
            {
                UIAlertView alert = new UIAlertView()
                {
                    Title   = "Sorry",
                    Message = "Something went wrong. We are on it"
                };
                alert.AddButton("OK");
                alert.Show();
                LoggingClass.LogError(ex.Message, screen, ex.StackTrace);
            }
        }
コード例 #4
0
        public void BindData(APLCollectionViewCell cell, NSIndexPath indexPath, Boolean fav)
        {
            try
            {
                cell.NavigationController = NavigationController;
                //cell.btlImage.SetBackgroundImage(UIImage.FromFile("Wines/wine" + indexPath.Item % 8 + ".png"), UIControlState.Normal);
                cell.parent = this.View;
                //NavigationController.NavigationBar.TopItem.Title = "Locations";

                int index = (int)indexPath.Item;

                //Data from Model
                //cell.WineName = myData.ItemList[index].Name;
                //cell.AmountLeft.SetProgress(Convert.ToSingle(myData.ItemList[index].AvailableVolume),true);
                double l = Math.Floor(Math.Log10(myData.ItemList[index].Vintage) + 1);
                if (l > 4)
                {
                    cell.Vintage = "";
                }
                else
                {
                    cell.Vintage = myData.ItemList[index].Vintage.ToString();
                }
                cell.AmountLeft.Text = "Wine left in bottle: " + myData.ItemList[index].AvailableVolume.ToString() + ".ml";
                cell.RegPrice        = myData.ItemList[index].SalePrice.ToString();
                cell.averageRating   = (decimal)myData.ItemList[index].AverageRating;
                cell.WineBarcode     = myData.ItemList[index].Barcode;
                //cell.btnBuy.TouchUpInside+= delegate {
                //	UIApplication.SharedApplication.OpenUrl(new NSUrl("http://www.wineoutlet.com/sku"+myData.ItemList[index].SKU+".html"));
                //};
                cell.Sku = myData.ItemList[index].SKU;
                if (fav == true)
                {
                    cell.storeId           = myData.ItemList[index].PlantFinal.ToString();
                    cell.AmountLeft.Hidden = true;
                }
                else
                {
                    cell.storeId = storeId.ToString();
                }
                cell.lblName.Text = myData.ItemList[index].Name;
                if (myData.ItemList[index].Vintage.ToString().Length < 4)
                {
                    cell.lblYear.Text = " ";
                }
                else
                {
                    cell.lblYear.Text = myData.ItemList[index].Vintage.ToString();
                }
                cell.lblRegPrice.Text         = myData.ItemList[index].RegPrice.ToString("C", Cultures.UnitedState);
                cell.ratingView.AverageRating = (decimal)myData.ItemList[index].AverageRating;
                cell.myItem = myData.ItemList[index];
                //Boolean temp;
                SKULike        like = new SKULike();
                ServiceWrapper sw   = new ServiceWrapper();
                cell.btnItemname.SetTitle(myData.ItemList[index].Name, UIControlState.Normal);
                if (myData.ItemList[index].IsLike == true)
                {
                    cell.heartImage.SetImage(UIImage.FromFile("heart_full.png"), UIControlState.Normal);
                    cell.heartImage.Tag = 1;
                    //cell.heartImage.TouchUpInside +=async delegate
                    //{
                    //	if (CurrentUser.RetreiveUserId() != 0)
                    //	{
                    //		cell.heartImage.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                    //		like.UserID = Convert.ToInt32(CurrentUser.RetreiveUserId());
                    //		like.BarCode = cell.WineBarcode;
                    //		like.Liked = false;
                    //		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("http://savvyitdev.com/winehangouts/"));
                    //			}
                    //		};
                    //		alert.Show();
                    //	}
                    //};
                }
                else
                {
                    cell.heartImage.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                    cell.heartImage.Tag = 0;
                    //cell.heartImage.TouchUpInside +=async delegate
                    //{
                    //	if (CurrentUser.RetreiveUserId() != 0)
                    //	{
                    //		cell.heartImage.SetImage(UIImage.FromFile("heart_full.png"), UIControlState.Normal);
                    //		like.UserID = Convert.ToInt32(CurrentUser.RetreiveUserId());
                    //		like.BarCode = cell.WineBarcode;
                    //		like.Liked = true;
                    //		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("http://savvyitdev.com/winehangouts/"));
                    //			}
                    //		};
                    //		alert.Show();
                    //	}
                    //};
                }
                //UIImage image = BlobWrapper.GetImageBitmapFromWineId(myData.ItemList[index].WineId.ToString());
                string url = myData.ItemList[index].SmallImageUrl;
                if (url == null)
                {
                    url = myData.ItemList[index].Barcode + ".jpg";
                }
                UIImage image = BlobWrapper.GetResizedImage(url, cell.btlImage.Bounds, cell.storeId.ToString());
                if (image != null)
                {
                    cell.btlImage.SetImage(image, UIControlState.Normal);
                }
                else
                {
                    cell.btlImage.SetImage(img, UIControlState.Normal);
                }
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.Message, screen, ex.StackTrace.ToString());
                UIAlertView alert = new UIAlertView()
                {
                    Title = "Something went wrong. We are on it."
                            //Message = "Coming Soon..."
                };

                alert.AddButton("OK");
                alert.Show();
            }
        }