private void AddParameterBlockButton_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(ParamNameTextbox.Text)) return; if (!EditingParameter) { foreach (ParameterBlock p in ParametersCheckedlistbox.Items) if (p.Name == ParamNameTextbox.Text) return; ParameterBlock newTSB = new ParameterBlock(); newTSB.Name = ParamNameTextbox.Text; newTSB.Group = ParameterGroupEditbox.Text; ParametersCheckedlistbox.Items.Add(newTSB, true); } else { EditingPB.Name = ParamNameTextbox.Text; EditingPB.Group = ParameterGroupEditbox.Text; ParametersCheckedlistbox.Items[EditingPB.Index] = EditingPB; ParamNameTextbox.Enabled = true; EditingParameter = false; CancelParameterEditButton.Enabled = false; EditTSBlockButton.Enabled = true; DeleteTSButton.Enabled = true; } }
private void ParamEditButton_Click(object sender, EventArgs e) { if (ParametersCheckedlistbox.SelectedIndex > -1) { EditingParameter = true; EditingPB = (ParameterBlock)(ParametersCheckedlistbox.Items[ParametersCheckedlistbox.SelectedIndex]); EditingPB.Index = ParametersCheckedlistbox.SelectedIndex; ParamNameTextbox.Text = EditingPB.Name; ParameterGroupEditbox.Text = EditingPB.Group; ParamNameTextbox.Enabled = false; CancelParameterEditButton.Enabled = true; ParamEditButton.Enabled = false; ParamDeleteButton.Enabled = false; } }