Пример #1
0
        private void SetClickEvents()
        {
            AddItem.Click += delegate
            {
                var product = _eventHandler.OnAddItemToCheckoutEvent(this, LayoutPosition);
                UpdateProductAmount(product);
                UpdateProductDiscount(product);
            };

            RemoveItem.Click += delegate
            {
                if (Amount == 0)
                {
                    return;
                }

                var product = _eventHandler.OnRemoveItemFromCheckout(this, LayoutPosition);
                UpdateProductAmount(product);
                UpdateProductDiscount(product);
            };

            IsFavourite.Click += delegate
            {
                _eventHandler.OnFavouriteEvent(this, LayoutPosition);
            };
        }
Пример #2
0
        internal void UpdateCell(Product product)
        {
            lblProductName.Text   = product.Name;
            lblProductPrice.Text  = string.Format(CultureInfo.GetCultureInfo("pt-BR"), "{0:C}", product.Price);
            imgProductPhoto.Image = product.Photo.ToUIImage();

            UpdateProductAmount(product);
            UpdateProductDiscount(product);
            UpdateProductFavourited(product);

            btnAdd.TouchUpInside += delegate
            {
                _productEventHandler.OnAddItemToCheckoutEvent(product);
                UpdateProductAmount(product);
                UpdateProductDiscount(product);
            };

            btnRemove.TouchUpInside += delegate
            {
                _productEventHandler.OnRemoveItemFromCheckout(product);
                UpdateProductAmount(product);
                UpdateProductDiscount(product);
            };

            btnIsFavourite.TouchUpInside += delegate
            {
                _productEventHandler.OnFavouriteEvent(product);
                UpdateProductFavourited(product);
            };
        }