Example #1
0
        public void OnSelection(MaterialDialog p0, View p1, int itemId, ICharSequence itemString)
        {
            try
            {
                switch (TypeDialog)
                {
                case "Currency":
                    TxtCurrency.Text = itemString.ToString();

                    var(currency, currencyIcon) = WoWonderTools.GetCurrency(itemId.ToString());
                    CurrencyId = currency;
                    Console.WriteLine(currencyIcon);
                    break;

                case "DiscountOffersAdapter":
                {
                    AddDiscountId = WoWonderTools.GetAddDiscountList(this)?.FirstOrDefault(a => a.Value == itemString.ToString()).Key.ToString();

                    TxtDiscountType.Text = itemString.ToString();

                    switch (AddDiscountId)
                    {
                    case "free_shipping":
                        MRecycler.Visibility = ViewStates.Gone;
                        MAdapter.DiscountList.Clear();
                        MAdapter.NotifyDataSetChanged();
                        break;

                    default:
                        MRecycler.Visibility = ViewStates.Visible;
                        MAdapter.DiscountList.Clear();

                        MAdapter.DiscountList.Add(new DiscountOffers
                            {
                                DiscountType  = AddDiscountId,
                                DiscountFirst = "",
                                DiscountSec   = "",
                                DiscountThr   = "",
                            });
                        MAdapter.NotifyDataSetChanged();
                        break;
                    }

                    break;
                }
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
Example #2
0
        public void OnSelection(MaterialDialog p0, View p1, int itemId, ICharSequence itemString)
        {
            try
            {
                if (TypeDialog == "Currency")
                {
                    TxtCurrency.Text = itemString.ToString();

                    var(currency, currencyIcon) = WoWonderTools.GetCurrency(itemId.ToString());
                    CurrencyId = currency;
                    Console.WriteLine(currencyIcon);
                }
                else if (TypeDialog == "DiscountOffersAdapter")
                {
                    AddDiscountId = WoWonderTools.GetAddDiscountList(this)?.FirstOrDefault(a => a.Value == itemString.ToString()).Key.ToString();

                    TxtDiscountType.Text = itemString.ToString();

                    if (AddDiscountId == "free_shipping")
                    {
                        MRecycler.Visibility = ViewStates.Gone;
                        MAdapter.DiscountList.Clear();
                        MAdapter.NotifyDataSetChanged();
                    }
                    else
                    {
                        MRecycler.Visibility = ViewStates.Visible;
                        MAdapter.DiscountList.Clear();

                        MAdapter.DiscountList.Add(new DiscountOffers()
                        {
                            DiscountType  = AddDiscountId,
                            DiscountFirst = "",
                            DiscountSec   = "",
                            DiscountThr   = "",
                        });
                        MAdapter.NotifyDataSetChanged();
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #3
0
        private void TxtDiscountTypeOnTouch(object sender, View.TouchEventArgs e)
        {
            try
            {
                if (e.Event.Action != MotionEventActions.Down)
                {
                    return;
                }

                TypeDialog = "DiscountOffersAdapter";

                var dialogList   = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light);
                var arrayAdapter = WoWonderTools.GetAddDiscountList(this).Select(pair => pair.Value).ToList();
                dialogList.Title(GetText(Resource.String.Lbl_DiscountType));
                dialogList.Items(arrayAdapter);
                dialogList.NegativeText(GetText(Resource.String.Lbl_Close)).OnNegative(this);
                dialogList.AlwaysCallSingleChoiceCallback();
                dialogList.ItemsCallback(this).Build().Show();
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }