private void btnAddCoolant_Click(object sender, EventArgs e) { CoolantSelForm csf = new CoolantSelForm(config); csf.ShowDialog(); if (csf.IsAddCoolant()) { lbCoolant.Items.Add(csf.GetCoolant()); lbHeaters.Items.Add(csf.GetHeaters()); } }
private void btnHeaterCount_Click(object sender, EventArgs e) { if (lbCoolant.SelectedIndex == -1) { MessageBox.Show("You must select a heater type!"); return; } CoolantSelForm csf = new CoolantSelForm(config, lbCoolant.Items[lbCoolant.SelectedIndex].ToString(), double.Parse(lbHeaters.Items[lbHeaters.SelectedIndex].ToString())); csf.ShowDialog(); if (csf.IsAddCoolant()) { int index = lbCoolant.SelectedIndex; lbCoolant.Items.RemoveAt(index); lbHeaters.Items.RemoveAt(index); lbCoolant.Items.Insert(index, csf.GetCoolant()); lbHeaters.Items.Insert(index, csf.GetHeaters()); } }