// add dde handler // callback to CAPICallback to authorized to change the state. private void buttonAddCommander_Click(object sender, EventArgs e) { cf = new EliteDangerousCore.Forms.CommanderForm(AdditionalCmdrControls()); cf.Init(true); discoveryform.FrontierCAPI.StatusChange += CAPICallBack; SetCAPILabelState(); if (cf.ShowDialog(FindForm()) == DialogResult.OK) { if (cf.Valid && !EDCommander.IsCommanderPresent(cf.CommanderName)) { EDCommander cmdr = new EDCommander(); cf.Update(cmdr); EDCommander.Add(cmdr); UpdateCommandersListBox(); discoveryform.LoadCommandersListBox(); discoveryform.RefreshHistoryAsync(); // will do a new parse on commander list adding/removing scanners btnDeleteCommander.Enabled = EDCommander.NumberOfCommanders > 1; } else { ExtendedControls.MessageBoxTheme.Show(FindForm(), "Commander name is not valid or duplicate".T(EDTx.UserControlSettings_AddC), "Cannot create Commander".T(EDTx.UserControlSettings_AddT), MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } } discoveryform.FrontierCAPI.StatusChange -= CAPICallBack; }