Esempio n. 1
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            if (categoryItems.ContainsKey(item.ItemId))
            {
                AppData.Categories.ForEach(x => {
                    x.Selected = false;
                });

                if (categoryItems[item.ItemId] != null)
                {
                    categoryItems[item.ItemId].Selected = true;
                }
                CatalogListAdapter.UpdateCatalog();
            }
            switch (item.ItemId)
            {
            /*case Android.Resource.Id.Home:
             *  if (viewPager == null) { return true; }
             *  if (viewPager.CurrentItem == 0)
             *  {
             *      drawerLayout.OpenDrawer(Android.Support.V4.View.GravityCompat.Start);
             *  }
             *  else
             *  {
             *      viewPager.SetCurrentItem(0, true);
             *  }
             *
             *  return true;*/
            case Resource.Id.action_filter:

            default:
                return(base.OnOptionsItemSelected(item));
            }
        }
        private void UpdateData()
        {
            var discount = AppData.CurrentCart.DiscountFor(product);
            var price    = AppData.CurrentCart.PriceFor(product);
            var quantity = AppData.CurrentCart.QuantityFor(product);

            TextView       productDiscount = FindViewById <TextView>(Resource.Id.detailProductSale);
            TextView       productValue    = FindViewById <TextView>(Resource.Id.detailProductPrice);
            TextView       itemCountText   = FindViewById <TextView>(Resource.Id.detailQuantity);
            RelativeLayout discountLayout  = FindViewById <RelativeLayout>(Resource.Id.detailSaleLayout);

            itemCountText.Text        = string.Format("{0} UN", quantity);
            discountLayout.Visibility = discount <= 0.0 ? ViewStates.Invisible : ViewStates.Visible;
            productDiscount.Text      = String.Format("↓{0:0.0}%", discount).Replace(".", ",");
            productValue.Text         = price.ToString("C", CultureInfo.CreateSpecificCulture("pt-BR"));

            RunOnUiThread(() =>
            {
                MainActivity.UpdateBuyButton();
                //FragmentCart.UpdateCart();
                CatalogListAdapter.UpdateCatalog();
            });
        }