Ejemplo n.º 1
0
        public void SetValue(GroupItem item)
        {
            SetVisibility(item.Type == EGroupItemType.Header);

            if (item.Type == EGroupItemType.Header)
            {
                LblSale.Text = item.Sale.Name;
            }
            else
            {
                LblProductName.Text  = item.Product.Name;
                LblProductPrice.Text = $"R$ {item.Product.Price:###,###,###,##0.00}";
                LblAmount.Text       = $"{item.Count} UN";
                if (item.Discount > 0)
                {
                    LblDiscount.Text  = $"{item.Discount:##0.0}%";
                    VwDiscount.Hidden = false;
                }
                else
                {
                    VwDiscount.Hidden = true;
                }

                if (item.Product.Favorite)
                {
                    BtnFavorite.SetImage(UIImage.GetSystemImage("star.fill"), UIControlState.Normal);
                }
                else
                {
                    BtnFavorite.SetImage(UIImage.GetSystemImage("star"), UIControlState.Normal);
                }

                ImageService.Instance.LoadUrl(item.Product.Photo)
                //.ErrorPlaceholder("error.png", ImageSource.ApplicationBundle)
                //.LoadingPlaceholder("placeholder", ImageSource.CompiledResource)
                .Into(ImgProduct);
            }
        }
        void ReleaseDesignerOutlets()
        {
            if (BtnAdd != null)
            {
                BtnAdd.Dispose();
                BtnAdd = null;
            }

            if (BtnFavorite != null)
            {
                BtnFavorite.Dispose();
                BtnFavorite = null;
            }

            if (BtnRemove != null)
            {
                BtnRemove.Dispose();
                BtnRemove = null;
            }

            if (ImgProduct != null)
            {
                ImgProduct.Dispose();
                ImgProduct = null;
            }

            if (LblAmount != null)
            {
                LblAmount.Dispose();
                LblAmount = null;
            }

            if (LblDiscount != null)
            {
                LblDiscount.Dispose();
                LblDiscount = null;
            }

            if (LblProductName != null)
            {
                LblProductName.Dispose();
                LblProductName = null;
            }

            if (LblProductPrice != null)
            {
                LblProductPrice.Dispose();
                LblProductPrice = null;
            }

            if (LblSale != null)
            {
                LblSale.Dispose();
                LblSale = null;
            }

            if (VwDiscount != null)
            {
                VwDiscount.Dispose();
                VwDiscount = null;
            }
        }