Beispiel #1
0
        public void ProcessKey(Keys key)
        {
            if (Selected != null)
            {
                switch (key)
                {
                case Keys.NumPad2:
                    SelectNext();
                    break;

                case Keys.NumPad8:
                    SelectPrevious();
                    break;

                case Keys.NumPad6:
                    if (Selected is UINumericalButton)
                    {
                        IncrementSelected();
                    }
                    else if (Selected is UISwitchButton)
                    {
                        UISwitchButton switchButton = (UISwitchButton)Selected;
                        switchButton.Next();
                    }
                    else
                    {
                        UseSelected();
                    }
                    break;

                case Keys.NumPad4:

                    if (Selected is UINumericalButton)
                    {
                        DecrementSelected();
                    }

                    if (Selected is UISwitchButton)
                    {
                        UISwitchButton switchButton = (UISwitchButton)Selected;
                        switchButton.Previous();
                    }
                    else
                    {
                        UseSelected();
                    }

                    break;

                case Keys.NumPad5:
                    Selected.OnClick(EventArgs.Empty);
                    break;
                }
            }
        }
Beispiel #2
0
        public UISwitchButton AddSwitchButton(String text, String desc, String[] items)
        {
            if (listButtons.Count == 1)
            {
                SelectIndex(0);
            }
            UISwitchButton btn = new UISwitchButton(text, desc, items, 5, y_spacing * listButtons.Count);

            listButtons.Add(btn);
            return(btn);
        }