private void deleteToolStripMenuItem_Click(object sender, EventArgs e) { if (dataGridViewCommanders.RightClickRow >= 0) { int row = dataGridViewCommanders.RightClickRow; EDCommander cmdr = dataGridViewCommanders.Rows[row].DataBoundItem as EDCommander; var result = ExtendedControls.MessageBoxTheme.Show(FindForm(), "Do you wish to delete commander ".T(EDTx.UserControlSettings_DelCmdr) + cmdr.Name + "?", "Warning".T(EDTx.Warning), MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (result == DialogResult.Yes) { EDCommander.Delete(cmdr); UpdateCommandersListBox(); } } }
private void btnDeleteCommander_Click(object sender, EventArgs e) { if (dataGridViewCommanders.SelectedRows.Count > 0) { int row = dataGridViewCommanders.SelectedRows[0].Index; EDCommander cmdr = dataGridViewCommanders.Rows[row].DataBoundItem as EDCommander; var result = ExtendedControls.MessageBoxTheme.Show(FindForm(), "Do you wish to delete commander ".T(EDTx.UserControlSettings_DelCmdr) + cmdr.Name + "?", "Warning".T(EDTx.Warning), MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (result == DialogResult.Yes) { EDCommander.Delete(cmdr); discoveryform.LoadCommandersListBox(); UpdateCommandersListBox(); discoveryform.RefreshHistoryAsync(); // will do a new parse on commander list adding/removing scanners btnDeleteCommander.Enabled = EDCommander.NumberOfCommanders > 1; } } }