/// <summary> /// редактировать команду /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button2_Click(object sender, EventArgs e) { if (listView1.SelectedItems != null && listView1.SelectedItems.Count > 0) { BlockViewCommand command = listView1.SelectedItems[0].Tag as BlockViewCommand; if (command != null) { BlockCommandForm frm = new BlockCommandForm(); frm.Text = "Редактирование команды БО"; frm.CommandDSN = command.CommandDsn; frm.UseReset = command.UseForReset; frm.UseNext = command.UseForNextStage; if (frm.ShowDialog(this) == DialogResult.OK) { command.CommandDsn = frm.CommandDSN; command.UseForReset = frm.UseReset; command.UseForNextStage = frm.UseNext; listView1.SelectedItems[0].SubItems[1].Text = command.CommandDsn; listView1.SelectedItems[0].SubItems[2].Text = command.TextType; } } } }
/// <summary> /// добавить команду /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { BlockCommandForm frm = new BlockCommandForm(); frm.Text = "Добавление команды БО"; if (frm.ShowDialog(this) == DialogResult.OK) { BlockViewCommand command = new BlockViewCommand(); command.CommandDsn = frm.CommandDSN; command.UseForReset = frm.UseReset; command.UseForNextStage = frm.UseNext; if (_app != null) { _app.Commands.Add(command); InsertToiList(command); } } }