コード例 #1
0
        public void ChangeFormState()
        {
            textBoxShipName.Text       = Ship.ShipName;
            textBoxShipMacro.Text      = Ship.ShipMacro;
            textBoxShipClass.Text      = Ship.ShipClass;
            textBoxShipId.Text         = Ship.ShipId;
            textBoxShipKnownTo.Text    = Ship.ShipKnownTo;
            textBoxShipConnection.Text = Ship.ShipConnection;

            comboBoxShipOwner.Items.AddRange(cde.GetAllFactions().ToArray());
            comboBoxShipOwner.SelectedItem = Ship.ShipOwner;
        }
コード例 #2
0
        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);
            }
        }