private void button2_Click(object sender, EventArgs e) { var form = new NewParamForm(this); form.Text += "фактор"; int index = 0; for (int i = 0; i < technologicalParameters.Count; i++) { TechnologicalParameter a = (TechnologicalParameter)lstTechParams.Items[lstTechParams.SelectedIndex]; if (a.Caption == technologicalParameters[i].Caption) { form.txtCaption.Text = a.Caption; form.txtUnit.Text = a.Unit; index = i; } } if (form.ShowDialog() == DialogResult.OK) { var param = new TechnologicalParameter { Caption = form.txtCaption.Text, Unit = form.txtUnit.Text }; technologicalParameters.RemoveAt(index); technologicalParameters.Insert(index, param); BindParams(); } }
private void BtnNewParamClick(object sender, EventArgs e) { if (technologicalParameters.Count == 3) { MessageBox.Show("Возможен ввод только трёх факторов", "Ошибка"); } else { var form = new NewParamForm(this); form.Text += "фактор"; if (form.ShowDialog() == DialogResult.OK) { var param = new TechnologicalParameter { Caption = Caption, ShortCaption = ShortCaption, Unit = Unit }; technologicalParameters.Add(param); BindParams(); } } }
private void BtnNewQualityClick(object sender, EventArgs e) { var form = new NewParamForm(this); form.Text += "отклик"; if (form.ShowDialog() == DialogResult.OK) { var quality = new Quality { Caption = Caption, ShortCaption = ShortCaption, Unit = Unit }; qualities.Clear(); qualities.Add(quality); BindQualities(); } }