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; }
private void Control_UpClick(object sender, EventArgs e) { IWheelButton movedButton = (IWheelButton)((ElementListItem)sender).Element; if (Buttons[0] == movedButton) { return; } Buttons.MoveElement(movedButton, -1); UpdateButtonList(); }
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(); } }
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; } }
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); }