示例#1
0
		public void Add (Product product)
		{
			products.Insert (0,(Product)product.Clone());
			var evt = ProductsChanged;
			if (evt != null)
				evt (this, EventArgs.Empty);
		}
示例#2
0
		public bool Remove (Product product)
		{
			var result = products.Remove (product);
			if (result) {
				var evt = ProductsChanged;
				if (evt != null)
					evt (this, EventArgs.Empty);
			}
			return result;
		}
		void HandleTrashButtonTapped (object sender, Product e)
		{
			confirmRemoveItemDelegate = new DispatchingAlertViewDelegate ();
			confirmRemoveItemDelegate.ButtonClicked += delegate(object del, int buttonIndex) {
				if(buttonIndex==1) {
					order.Remove(e);
					TableView.ReloadSections(new MonoTouch.Foundation.NSIndexSet(0),UITableViewRowAnimation.Fade);
					UpdateTotals();
					CheckEmpty();
				}
			};
			new UIAlertView ("Confirm", "Are you sure you would like to remove this item from your basket?", confirmRemoveItemDelegate, "Never mind", "Remove").Show ();
		}
		public void Update(Product product)
		{
			Name.Text = product.Name;
			DescriptionLabel.Text = product.Description;
			Price.Text = product.PriceDescription;
		}
		public ProductDescriptionView(Product product) : this()
		{
			this.Update(product);
		}
        public void ShowProductDetail(Product product, int itemVerticalOffset)
        {
            var productDetails = new ProductDetailsFragment (product, itemVerticalOffset);

            productDetails.AddToBasket += p => {
                WebService.Shared.CurrentOrder.Add (p);

                SetupActionBar ();
            };

            SwitchScreens (productDetails);
        }
				public async Task Update (Product product)
				{
					NameLabel.Text = product.Name;
					SizeLabel.Text = product.Size.Description;
					ColorLabel.Text = product.Color.Name;
					PriceLabel.Text = product.PriceDescription;
					var imageTask = FileCache.Download (product.ImageForSize (320));
					if(!imageTask.IsCompleted)
						//Put default before doing the web request;
						ImageView.Image = Image.Value;
					var image = await imageTask;
					ImageView.Image = UIImage.FromFile (image);
				}
		public ProductDetailsFragment (Product product,int slidingDelta )
		{
			this.slidingDelta = slidingDelta;
			currentProduct = product;
			images = product.ImageUrls.ToArray().Shuffle() ?? new string[0];
		}
				public async Task Update (Product product)
				{
					var isSurprise = product.GetType () == typeof(SurpriseProduct);

					NameLabel.Text = isSurprise ? SurpriseProduct.SurpriseProductName : product.Name;
					SizeLabel.Text = isSurprise ? "???" : product.Size.Description;
					ColorLabel.Text = isSurprise ? "???" : product.Color.Name;
					PriceLabel.Text = product.PriceDescription;

					if (!isSurprise) 
					{
						var imageTask = FileCache.Download (product.ImageForSize (320));
						if (!imageTask.IsCompleted)
							//Put default before doing the web request;
							ImageView.Image = Image.Value;
						var image = await imageTask;
						ImageView.Image = UIImage.FromFile (image);
					}
				}
			void HandleTrashButtonTapped (object sender, Product e)
			{
				if (this.TrashButtonTapped != null)
					this.TrashButtonTapped (sender, e);
			}
			async void LoadProductImage (View mainView, ProgressBar progressView, ImageView imageView, Product product)
			{
				var currentId = mainView.Id;
				progressView.Visibility = ViewStates.Visible;
				imageView.SetImageResource (Android.Resource.Color.Transparent);
				await Images.SetImageFromUrlAsync (imageView,product.ImageForSize (Images.ScreenWidth));
				progressView.Visibility = ViewStates.Invisible;
			}
示例#12
0
 public void Add(Product product)
 {
     if (product == null) throw new ArgumentNullException("product");
     products.Insert (0,(Product)product.Clone());
     var evt = ProductsChanged;
     if (evt != null)
         evt (this, EventArgs.Empty);
 }
示例#13
0
 public bool Remove(Product product)
 {
     if (product == null) throw new ArgumentNullException("product");
     var result = products.Remove (product);
     if (result) {
         var evt = ProductsChanged;
         if (evt != null)
             evt (this, EventArgs.Empty);
     }
     return result;
 }