// Checks the input values of the textboxes and start the calibration calculation. // If the caluclation is finished, the window can be closed with the button. private void buttonCalculate_Click(object sender, EventArgs e) { if (!_finished) { label5.Visible = true; bool abort = false; try { //Preload = Convert.ToDouble(textBox1.Text, Provider); _strCommaDot = textBox1.Text.Replace(".", ","); _preload = double.Parse(_strCommaDot); textBox1.Enabled = false; } catch (FormatException) { label5.Text = "wrong number format"; abort = true; } catch (OverflowException) { label5.Text = "Overflow! Number to big."; abort = true; } try { //Capacity = Convert.ToDouble(textBox2.Text, Provider); _strCommaDot = textBox2.Text.Replace(".", ","); _capacity = double.Parse(_strCommaDot); textBox2.Enabled = false; } catch (FormatException) { label5.Text = "wrong number format"; abort = true; } catch (OverflowException) { label5.Text = "Overflow! Number to big."; abort = true; } if (abort) { return; } _wtxObj.Calculate(_preload, _capacity); label5.Text = "Calibration Successful!"; _finished = true; buttonCalculate.Text = "Close"; } else { Close(); } }