private void comboBoxFaction_SelectedIndexChanged(object sender, EventArgs e) { try { if (Previousfaction != null) { Previousfaction.UpdateBoosterPartners(); } if (comboBoxFaction.SelectedItem != null && comboBoxFaction.Items.Contains(comboBoxFaction.SelectedItem) ) { Previousfaction = null; comboBox1.Items.Clear(); dataGridViewRelations.DataSource = null; dataGridViewLicenses.DataSource = null; FactionData faction = sge.Factions[(string)comboBoxFaction.SelectedItem]; if (faction != null) { dataGridViewRelations.DataSource = faction.Boosters; dataGridViewLicenses.DataSource = faction.Licences; Previousfaction = faction; comboBox1.Items.AddRange(cde.GetAllFactions().Where(a => a != comboBoxFaction.Text && !((List <BoosterData>)dataGridViewRelations.DataSource).Exists(b => b.faction == a)).ToArray()); } } else { Previousfaction = null; } } catch (Exception ex) { Logger.Error("Unable to select the faction.", ex); MessageBox.Show("Unable to select the faction." + "\n" + StandardErrorText); } }
private void dataGridViewRelations_CellEndEdit(object sender, DataGridViewCellEventArgs e) { FactionData faction = sge.Factions[(string)comboBoxFaction.SelectedItem]; faction.UpdateBoosterPartners(); }