Exemple #1
0
        private void buttonDebugSetCriticalHigh_Click(object sender, EventArgs e)
        {
            byte  ch;
            float value, gain;

            if (checkBoxDebugUseDefGain.Checked)
            {
                // Use gain that is inferred from configuration file
                try
                {
                    ch    = InputValidatorHelperClass.GetChModeFromComboBox(comboBoxDebugSetCritHigh);
                    value = float.Parse(textBoxDebugSetCriticalHigh.Text);
                    if (ch == 0)
                    {
                        gain = ConfigClass.deviceGainCH0;
                    }
                    else
                    {
                        gain = ConfigClass.deviceGainCH1;
                    }
                    value = value / gain;
                }
                catch (Exception)
                {
                    MessageBox.Show("Insert valid values!");
                    return;
                }
            }
            else
            {
                // Use gain that is parsed from textbox
                try
                {
                    ch    = InputValidatorHelperClass.GetChModeFromComboBox(comboBoxDebugSetCritHigh);
                    value = float.Parse(textBoxDebugSetCriticalHigh.Text);
                    gain  = float.Parse(textBoxDebugSetCriticalHighGain.Text);
                    value = value / gain;
                }
                catch (Exception)
                {
                    MessageBox.Show("Insert valid values!");
                    return;
                }
            }

            com.AppendSetCriticalHigh(value, ch);
            textBoxDebugInstructionPool.Text += "SetCriticalHigh(" + value + ", " + comboBoxDebugSetCritHigh.Text + ")\r\n";
            FormCustomConsole.WriteLine("SetCriticalHigh(" + value + ", " + comboBoxDebugSetCritHigh.Text + ")");
        }