Beispiel #1
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            using (var dlg = new ParameterDialog())
            {
                dlg.Font          = Font;
                dlg.Text          = "New Test Parameter";
                dlg.StartPosition = FormStartPosition.CenterParent;

                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    var item = new ListViewItem(new string[] { dlg.ParameterName, dlg.ParameterValue });
                    listView1.Items.Add(item);
                    item.Selected = true;
                    saveButton.Focus();
                }
            }
        }
Beispiel #2
0
        private void editButton_Click(object sender, EventArgs e)
        {
            var item  = listView1.SelectedItems[0];
            var name  = item.SubItems[0].Text;
            var value = item.SubItems[1].Text;

            using (var dlg = new ParameterDialog(name, value))
            {
                dlg.Font          = Font;
                dlg.Text          = "Edit Test Parameter";
                dlg.StartPosition = FormStartPosition.CenterParent;
                var result = dlg.ShowDialog(this);

                if (result == DialogResult.OK)
                {
                    item.SubItems[0].Text = dlg.ParameterName;
                    item.SubItems[1].Text = dlg.ParameterValue;
                    saveButton.Focus();
                }
            }
        }