Пример #1
0
        private void btnAddCmd_Click(object sender, EventArgs e)
        {
            var tmpfmCommand = new FrmAddCommands(WorkConst.STATE_ADD)
            {
                CommandId = BusinessLogic.NewGuid()
            };

            tmpfmCommand.ShowDialog();
            var dlr = tmpfmCommand.DialogResult;

            if (dlr == DialogResult.OK)
            {
                var lvi1 = new ListViewItem(tmpfmCommand.tbxCommandName.Text, 0);
                lvi1.SubItems.Add(tmpfmCommand.CommandId);
                lvi1.SubItems.Add(tmpfmCommand.tbxDes.Text);
                lvExCommand.Items.Add(lvi1);
            }
        }
Пример #2
0
 private void btnModifyCmd_Click(object sender, EventArgs e)
 {
     if (lvExCommand.SelectedItems.Count > 0)
     {
         var lvi1         = lvExCommand.SelectedItems[0];
         var tmpfmCommand = new FrmAddCommands(WorkConst.STATE_MOD)
         {
             tbxCommandName = { Text = lvi1.Text },
             CommandId      = lvi1.SubItems[1].Text,
             tbxDes         = { Text = lvi1.SubItems[2].Text }
         };
         tmpfmCommand.ShowDialog();
         var dlr = tmpfmCommand.DialogResult;
         if (dlr == DialogResult.OK)
         {
             lvi1.Text             = tmpfmCommand.tbxCommandName.Text;
             lvi1.SubItems[1].Text = tmpfmCommand.CommandId;
             lvi1.SubItems[2].Text = tmpfmCommand.tbxDes.Text;
         }
     }
 }