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); }
public bool RemoveWheel(IWheel wheel, IWheelElements elements) { Form dialog = new ComfirmationDialog($"Are you sure you wish to delete wheel '{wheel.Label}'?", "Comfirm deletion"); if (dialog.ShowDialog() == DialogResult.OK) { int index = elements.Wheels.IndexOf(wheel); elements.Wheels.Remove(wheel); if (wheel == elements.StartupWheel) { if (elements.Wheels.Count == 0) { elements.StartupWheel = null; } else { index = Math.Min(index, elements.Wheels.Count - 1); elements.StartupWheel = elements.Wheels[index];; } } return(true); } return(false); }