private void deleteConfigToolStripMenuItem_Click(object sender, EventArgs e) { var ID = (Guid)((ToolStripItem)sender).Tag; var idx = __JoyInfos.FindIndex(j => j.ID == ID); if (idx < 0) { return; } if (Panels.Any(dp => dp.CheckJoystickInUse(__JoyInfos[idx]))) { MessageBox.Show(this, String.Format("Unable to delete joystick {0}, it's in use by current configuration. Remove usage of joystick first", __JoyInfos[idx].Name), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (MessageBox.Show(this, string.Format("Delete joystick {0}", __JoyInfos[idx].Name), "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return; } __JoyInfos.RemoveAt(idx); foreach (var panel in Panels) { panel.JoystickUpdated(); } SetChangedState(); UpdateJoystics(); }
/// <summary> /// Updates the menus and invalidates the currently active grid. /// </summary> public void UpdateView() { var hasPanels = Panels.Any(); lblNoLayers.Visible = !hasPanels; toolStripEx1.Enabled = hasPanels; var fs = ActiveFeatureSet; toolRemoveSelected.Enabled = fs != null && fs.InteractiveEditing; UpdateMenus(); UpdateEditingIcon(); UpdatePanelCaption(ActiveLayerHandle); var grid = ActiveGrid; if (grid != null) { grid.Invalidate(); } }