private void CommandButton_Click(object sender, EventArgs e) { var data = new CommandData(); data.Name = CommandListManager.GetInstance()[CommandComboBox.SelectedIndex].Name; data.Type = CommandListManager.GetInstance()[CommandComboBox.SelectedIndex].Type; data.Checked = true; gTaskData.CommandDataList.Add(data); var form = new CommandForm(gTaskData.CommandDataList[gTaskData.CommandDataList.Count - 1]); if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK) { AddDataGridView(data); } }
private void EditToolStripMenuItem_Click(object sender, EventArgs e) { foreach (DataGridViewRow row in dataGridView1.SelectedRows) { var editCommand = (CommandData)commandDataBindingSource[row.Index]; var form = new CommandForm(editCommand); if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK) { commandDataBindingSource[row.Index] = editCommand; gTaskData.CommandDataList[row.Index] = editCommand; } } }
private void dataGridView1_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.RowIndex == -1) return; var editCommand = (CommandData)commandDataBindingSource[e.RowIndex]; var form = new CommandForm(editCommand); if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK) { commandDataBindingSource[e.RowIndex] = editCommand; gTaskData.CommandDataList[e.RowIndex] = editCommand; } }