Ejemplo n.º 1
0
        private void buttonAddCommander_Click(object sender, EventArgs e)
        {
            CommanderForm cf = new CommanderForm();

            cf.Init(true);

            if (cf.ShowDialog(FindForm()) == DialogResult.OK)
            {
                if (cf.Valid && !EDCommander.IsCommanderPresent(cf.CommanderName))
                {
                    EDCommander cmdr = new EDCommander();
                    cf.Update(cmdr);
                    EDCommander.Create(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".Tx(this, "AddC"), "Cannot create Commander".Tx(this, "AddT"), MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
            }
        }
Ejemplo n.º 2
0
        private void buttonEditCommander_Click(object sender, EventArgs e)
        {
            if (dataGridViewCommanders.SelectedRows.Count > 0)
            {
                int         row  = dataGridViewCommanders.SelectedRows[0].Index;
                EDCommander cmdr = dataGridViewCommanders.Rows[row].DataBoundItem as EDCommander;

                CommanderForm cf = new CommanderForm();
                cf.Init(cmdr, false);

                if (cf.ShowDialog(FindForm()) == DialogResult.OK)
                {
                    bool forceupdate = cf.Update(cmdr);
                    List <EDCommander> edcommanders = (List <EDCommander>)dataGridViewCommanders.DataSource;
                    discoveryform.LoadCommandersListBox();
                    EDCommander.Update(edcommanders, false);

                    if (forceupdate)                         // journal loc change forcing update
                    {
                        discoveryform.RefreshHistoryAsync(); // do a resync
                    }
                }
            }
        }