Exemplo n.º 1
0
        private void AddToolStripButton_Click(object sender, EventArgs e)
        {
            Command cmd = new Command("CMD 0", "-", Keys.None, new byte[64]);

            var additem = new AddForm(cmd);
            var res     = additem.ShowDialog();

            if (res == DialogResult.OK)
            {
                m_cmds.Add(cmd);
                TxDataGridView.Rows.Add(cmd.Name, cmd.GetTypeAsStr(), cmd.Desc, cmd.GetShortKeyAsStr(), "Send");
                if (EditToolStripButton.Enabled)
                {
                    return;
                }
                EditToolStripButton.Enabled   = true;
                RemoveToolStripButton.Enabled = true;
                SaveToolStripButton.Enabled   = true;
                // Add a CellClick handler to handle clicks in the button column.
                TxDataGridView.CellClick += m_tclk;
            }
        }
Exemplo n.º 2
0
        private void EditToolStripButton_Click(object sender, EventArgs e)
        {
            if (TxDataGridView.SelectedRows.Count <= 0)
            {
                return;
            }

            if (TxDataGridView.SelectedRows.Count > 1)
            {
                MessageBox.Show("Select just single row !", "Edit Error");
                return;
            }

            DataGridViewRow row     = TxDataGridView.SelectedRows[0];
            Command         cmd     = m_cmds[row.Index];
            var             additem = new AddForm(cmd);
            var             res     = additem.ShowDialog();

            if (res == DialogResult.OK)
            {
                row.SetValues(cmd.Name, cmd.GetTypeAsStr(), cmd.Desc, cmd.GetShortKeyAsStr(), "Send");
            }
        }