Ejemplo n.º 1
0
        public void DisplayProduct(ProductDetails productDetails, bool allowSellReturnables, bool showAvailable, bool editProducts)
        {
            this.productDetails = productDetails;

            SetTitle();

            var items = FindViewById<LinearLayout>(Resource.Id.items);
            items.AddView(CreateItemEach(showAvailable));

            if(productDetails.SaleProduct.ContainerCapacity > 1)
                items.AddView(CreateItemCase(showAvailable));

            if (showAvailable)
                FindViewById<TextView>(Resource.Id.available_title).Visibility = ViewStates.Visible;

            if (allowSellReturnables)
                SetupReturnables();
        }
Ejemplo n.º 2
0
        public void Show(ProductDetails productDetails, bool allowSellReturnables = false, bool showAvailable = false, bool editProducts = true)
        {
            var selector = (ProductSelector) LayoutInflater.Inflate(Resource.Layout.product_item_selector, null);
            var done = selector.FindViewById<Button>(Resource.Id.done);
            done.Click += delegate
            {
                if (productDetails.IsValid)
                {
                    selector.ShowError("");
                    Dismiss();
                    ItemStateChanged(productDetails);
                }
                else
                {
                    selector.ShowError(Context.Resources.GetString(Resource.String.product_selector_insufficient_stock));
                }
            };

            selector.DisplayProduct(productDetails, allowSellReturnables,showAvailable, editProducts);
            SetContentView(selector);                        
            Show();
        }