Example #1
0
        private void ThisItem_Click(object sender, EventArgs e)
        {
            TextViewWithId discount      = (TextViewWithId)sender;
            DiscountModel  discountModel = model.DiscountModels[discount.Position];

            DiscountSelected(this, new DiscountSelectedEventArgs(discountModel));
        }
Example #2
0
        private void ThisItem_Click(object sender, EventArgs e)
        {
            TextViewWithId    customerType      = (TextViewWithId)sender;
            CustomerTypeModel customerTypeModel = model.CustomerTypeModels[customerType.Position];

            CustomerTypeSelected(this, new CustomerTypeSelectedEventArgs(customerTypeModel));
        }
Example #3
0
        private void ThisItem_CheckedChange(object sender, CompoundButton.CheckedChangeEventArgs e)
        {
            CheckBoxWithId thisBox = (CheckBoxWithId)sender;

            if (!checking || subChecking)
            {
                if (thisBox.Group > 0 && !thisBox.Checked && !subChecking)
                {
                    checking        = true;
                    thisBox.Checked = true;
                    checking        = false;
                    return;
                }
                else if (thisBox.Group > 0 && !subChecking)
                {
                    foreach (CheckBoxWithId box in checkBoxes)
                    {
                        if (box.Group == thisBox.Group && box.Position != thisBox.Position)
                        {
                            subChecking = true;
                            box.Checked = false;
                            subChecking = false;
                        }
                    }
                }

                TextViewWithId  portions = this.portions[thisBox.Position];
                ImageViewWithId arrow    = arrows[thisBox.Position];
                ComponentModel  varModel = model.ComponentModels[thisBox.Position];

                if (thisBox.Checked)
                {
                    if (varModel.HasComponents)
                    {
                        arrow.Visibility = ViewStates.Visible;
                    }

                    if (varModel.Portions > 0)
                    {
                        portions.Visibility = ViewStates.Visible;
                    }
                    else
                    {
                        portions.Visibility = ViewStates.Invisible;
                    }
                }
                else
                {
                    arrow.Visibility    = ViewStates.Invisible;
                    portions.Visibility = ViewStates.Invisible;
                }

                ComponentChecked(this, new ComponentCheckedEventArgs(model.ComponentModels[thisBox.Position]));
            }
        }
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            Activity context = (Activity)parent.Context;

            View           view     = new LinearLayout(context);
            TextViewWithId thisItem = new TextViewWithId(context);

            thisItem.Position = position;
            thisItem.Text     = (position + 1).ToString();
            thisItem.SetTextColor(Color.Black);
            thisItem.SetTextSize(Android.Util.ComplexUnitType.Sp, 20);
            thisItem.Click += ThisItem_Click;

            ((LinearLayout)view).AddView(thisItem);
            thisItem.LayoutParameters.Width = 300;

            view.SetPadding(10, 0, 0, 0);

            return(view);
        }
Example #5
0
        public ComponentListViewAdapter(int id, Context context, ComponentListMode mode, bool ignoreDefaults = true)
        {
            model = new ComponentsModel(id, mode);

            int position = 0;

            foreach (ComponentModel cModel in model.ComponentModels)
            {
                CheckBoxWithId thisItem = new CheckBoxWithId(context);
                thisItem.Group       = cModel.Group;
                thisItem.Position    = position++;
                thisItem.ComponentId = cModel.Id;

                TextViewWithId portions = new TextViewWithId(context);
                portions.ComponentId = cModel.Id;
                portions.Text        = " " + cModel.Portions.ToString();
                portions.SetTextColor(Color.White);
                portions.SetBackgroundColor(Color.Black);
                portions.SetTextSize(Android.Util.ComplexUnitType.Sp, 25);
                portions.Click += Portions_Click;

                ImageViewWithId arrow = new ImageViewWithId(context);
                arrow.SetImageResource(Resource.Drawable.ViewComponents);
                arrow.SetPadding(5, 8, 0, 0);
                arrow.ComponentId = cModel.Id;
                arrow.Visibility  = ViewStates.Invisible;
                arrow.Click      += Arrow_Click;

                if (!ignoreDefaults && cModel.IsDefault)
                {
                    thisItem.Checked = true;
                }

                checkBoxes.Add(thisItem);
                this.portions.Add(portions);
                arrows.Add(arrow);
            }
        }
Example #6
0
        private void Portions_Click(object sender, EventArgs e)
        {
            TextViewWithId portions = (TextViewWithId)sender;

            PortionClicked(this, new PortionClickedEventArgs(portions));
        }
Example #7
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            Activity context = (Activity)parent.Context;

            ComponentModel varModel = model.ComponentModels[position];

            View view = new LinearLayout(context);

            view.LayoutDirection = LayoutDirection.Ltr;

            CheckBoxWithId thisItem = checkBoxes[position];

            if (thisItem.Parent != null)
            {
                thisItem.CheckedChange -= ThisItem_CheckedChange;
                ((LinearLayout)thisItem.Parent).RemoveAllViews();
            }

            thisItem.Position = position;

            thisItem.Text = varModel.Name;
            thisItem.SetTextColor(Color.Black);
            thisItem.SetTextSize(Android.Util.ComplexUnitType.Sp, 25);
            thisItem.CheckedChange += ThisItem_CheckedChange;

            ((LinearLayout)view).AddView(thisItem);
            thisItem.LayoutParameters.Width = 615;

            TextViewWithId  portions = this.portions[position];
            ImageViewWithId arrow    = arrows[position];

            if (thisItem.Checked)
            {
                if (varModel.HasComponents)
                {
                    arrow.Visibility = ViewStates.Visible;
                }

                if (varModel.Portions > 0)
                {
                    portions.Visibility = ViewStates.Visible;
                }
                else
                {
                    portions.Visibility = ViewStates.Invisible;
                }
            }
            else
            {
                arrow.Visibility    = ViewStates.Invisible;
                portions.Visibility = ViewStates.Invisible;
            }

            ((LinearLayout)view).AddView(portions);
            ((LinearLayout)view).AddView(arrow);
            portions.LayoutParameters.Width = 50;

            if (varModel.Group > 0)
            {
                view.SetBackgroundColor(Color.Beige);
            }

            view.SetPadding(10, 0, 0, 0);

            return(view);
        }
Example #8
0
        private void ThisItem_Click(object sender, EventArgs e)
        {
            TextViewWithId thisPortions = (TextViewWithId)sender;

            PortionSelected(this, new PortionSelectedEventArgs(model.PortionModels[thisPortions.Position].Number, thisPortions.ComponentId));
        }
 public PortionClickedEventArgs(TextViewWithId view)
 {
     this.view = view;
 }
        private void ThisItem_Click(object sender, EventArgs e)
        {
            TextViewWithId quantity = (TextViewWithId)sender;

            QuantitySelected(this, new QuantitySelectedEventArgs(quantity.Position));
        }