// 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;
                }

                _wtxDevice.Calculate(_preload, _capacity);

                label5.Text          = "Calibration Successful!";
                _finished            = true;
                buttonCalculate.Text = "Close";
            }
            else
            {
                Close();
            }
        }
Example #2
0
        /*
         * This method calcutes the values for a dead load and a nominal load(span) in a ratio in mV/V and write in into the WTX registers.
         */

        private static void CalculateCalibration()
        {
            _isCalibrating = true;

            zero_load_nominal_load_input();

            _wtxDevice.Calculate(_preload, _capacity);

            _isCalibrating = false;
        }