public ButtonEditorForm(IWheelButton button, IWheelElements elements)
        {
            InitializeComponent();
            this.button   = button;
            this.elements = elements;
            actionComboBox.Items.Add("None");

            foreach (var item in elements.Editor.ActionEditors)
            {
                actionComboBox.Items.Add(item.DisplayName);
            }

            actionComboBox.SelectedIndex = 0;
            if (button.Action != null)
            {
                var types = elements.Editor.ActionEditors.Select(item => item.Type).ToList();
                int index = types.IndexOf(button.Action.GetType());
                if (index > -1)
                {
                    comboboxChangedByUser        = false;
                    actionTriggerButton.Enabled  =
                        editActionButton.Enabled = true;
                    actionComboBox.SelectedIndex = index + 1;
                }
            }

            Action            = button.Action;
            nameTextBox.Text  = button.Label;
            imageTextBox.Text = button.ImgPath;
        }
Ejemplo n.º 2
0
        private void Control_UpClick(object sender, EventArgs e)
        {
            IWheelButton movedButton = (IWheelButton)((ElementListItem)sender).Element;

            if (Buttons[0] == movedButton)
            {
                return;
            }
            Buttons.MoveElement(movedButton, -1);
            UpdateButtonList();
        }
Ejemplo n.º 3
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            ElementListItem listItem = (ElementListItem)((Control)sender).Parent.Parent;
            IWheelButton    button   = (IWheelButton)listItem.Element;
            var             dialog   = new ComfirmationDialog($"Are you sure you wish to delete button '{button.Label}'?");

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                Buttons.Remove(button);
                UpdateButtonList();
            }
        }
Ejemplo n.º 4
0
        public bool EditButton(IWheelButton button, IWheelElements elements)
        {
            ButtonEditorForm form = new ButtonEditorForm(button, elements);

            if (form.ShowDialog() == DialogResult.OK)
            {
                button.Label   = form.Label;
                button.ImgPath = form.ImgPath;
                button.Action  = form.Action;
                return(true);
            }
            return(false);
        }
 public SimplifiedWheelButton(IWheelButton button, IWheelElements elements)
 {
     Label   = button.Label;
     ImgPath = button.ImgPath;
     if (button.Action != null)
     {
         Action = new SimplifiedWheelAction(button.Action, elements);
     }
     else
     {
         Action = null;
     }
 }
Ejemplo n.º 6
0
        public bool RemoveButton(IWheelButton button, IWheelElements elements)
        {
            var dialog = new ComfirmationDialog($"Are you sure you wish to delete button '{button.Label}'?", "Comfirmation");

            if (dialog.ShowDialog() != DialogResult.OK)
            {
                return(false);
            }
            elements.Buttons.Remove(button);
            foreach (IWheel wheel in elements.Wheels)
            {
                wheel.Buttons.Remove(button);
            }
            return(true);
        }