public void addNVPButton_click(object obj, EventArgs e) { bool showAgain = false; using (NameValueAddEdit_Dialog dlg = new NameValueAddEdit_Dialog("", "", "", null)) { DialogResult dlgResult = dlg.ShowDialog(); do{ if (dlgResult == DialogResult.OK) { showAgain = false; if (dlgResult == DialogResult.OK) { // do validation here // if validation fails, set showAgain to true showAgain = ((dlgResult == DialogResult.OK) && (!dlg.okButton_validating())); } } }while (showAgain); if (dlgResult == DialogResult.OK) { NameValueCollection.AddNameValuePair(dlg.NameTextBoxText, dlg.ValueTextBoxText); nameListBox.Items.Add(String.Format("{0}={1}", dlg.NameTextBoxText, dlg.ValueTextBoxText)); return; } else if (dlgResult == DialogResult.Cancel) { return; } } }
public void addNVPButton_click(object obj, EventArgs e) { bool showAgain = false; using (NameValueAddEdit_Dialog dlg = new NameValueAddEdit_Dialog("", "", "", null)) { DialogResult dlgResult = dlg.ShowDialog(); do { if (dlgResult == DialogResult.OK) { showAgain = false; if (dlgResult == DialogResult.OK) { // do validation here // if validation fails, set showAgain to true showAgain = ((dlgResult == DialogResult.OK) && (!dlg.okButton_validating())); } } }while (showAgain); if (dlgResult == DialogResult.OK) { NameValueCollection.AddNameValuePair(dlg.NameTextBoxText, dlg.ValueTextBoxText); nameListBox.Items.Add(String.Format("{0}={1}", dlg.NameTextBoxText, dlg.ValueTextBoxText)); return; } else if (dlgResult == DialogResult.Cancel) { return; } } }
public void editNVPButton_click(object obj, EventArgs e) { valueItem value; if (nameListBox.Items.Count > 0 && nameListBox.SelectedItem != null) { string name = nameListBox.SelectedItem.ToString(); value = NameValueCollection.LookUp(name); NameValueAddEdit_Dialog dlg; if (value == null) { return; } if (String.Equals(value.type, "enum")) { dlg = new NameValueAddEdit_Dialog(name, value.value, value.type, value.enumList); } else { dlg = new NameValueAddEdit_Dialog(name, value.value, value.type, null); } DialogResult dlgResult = dlg.ShowDialog(); if (dlgResult == DialogResult.OK) { NameValueCollection.EditNameValuePair(nameListBox.SelectedItem.ToString(), dlg.NameTextBoxText, dlg.ValueTextBoxText, value.type); } dlg.ValueTextbox.Visible = true; dlg.ValueTextbox.Visible = false; } }
private void addNVPButton_clicked(object sender, EventArgs e) { using (NameValueAddEdit_Dialog dlg = new NameValueAddEdit_Dialog("", "", "", null)) { dlg.Text = "Name Value Pair Add Dialog"; if (dlg.ShowDialog() == DialogResult.OK) { nameListBox.Items.Add(dlg.NameTextBoxText); NameValueCollection.AddNameValuePair(dlg.NameTextBoxText, dlg.ValueTextBoxText); } } }
private void editNVPButton_clicked(object sender, EventArgs e) { valueItem val; string oldName = nameListBox.SelectedItem.ToString(); val = NameValueCollection.LookUp(oldName); using (NameValueAddEdit_Dialog dlg = new NameValueAddEdit_Dialog(nameListBox.SelectedItem.ToString(), val.value, val.type, null)) { dlg.Text = "Name Value Pair Edit Dialog"; if (dlg.ShowDialog() == DialogResult.OK) { NameValueCollection.EditNameValuePair(oldName, dlg.NameTextBoxText, dlg.NameTextBoxText, val.type); } } }
private void editNVPButton_clicked(object sender, EventArgs e) { valueItem val; string oldName = nameListBox.SelectedItem.ToString(); val = NameValueCollection.LookUp(oldName); using (NameValueAddEdit_Dialog dlg = new NameValueAddEdit_Dialog(nameListBox.SelectedItem.ToString(), val.value, val.type,null)) { dlg.Text = "Name Value Pair Edit Dialog"; if (dlg.ShowDialog() == DialogResult.OK) { NameValueCollection.EditNameValuePair(oldName, dlg.NameTextBoxText, dlg.NameTextBoxText, val.type); } } }