private void SetupForm_Load(object sender, EventArgs e)
        {
            //autoFindBoardPort();
            if (settings.maxRepetitions > 1)
            {
                label17.Text = "The program will run up to " + settings.maxRepetitions + " rounds until the value is within " + settings.stabilizeWithin.ToString() + "g of the mean.";
            }
            else
            {
                label17.Text = "";
                label18.Text = "";
            }

            COMMS.autoFindPort();
            if (COMMS.connected == false)
            {
                Close();
                return;
            }
            //string testThatCOMworks = COMMS.ReadScale().ToString(); //reads the first weight value which will be first data point.

            try
            {
                textBox1.Text = settings.timerTimeMinutes.ToString();
            }
            catch (Exception)
            {
            }
            try
            {
                textBoxSeconds.Text = settings.timerTimeSeconds.ToString();
            }
            catch (Exception)
            {
            }

            try
            {
                textBox2.Text = settings.dataAcquisitionInterval.ToString();
            }
            catch (Exception)
            {
            }

            if (settings.upperSelected)
            {
                radioButton1.Checked = true;
                textBoxHeight.Text   = settings.upperHeight;
            }
            else if (settings.middleSelected)
            {
                radioButton2.Checked = true;
                textBoxHeight.Text   = settings.middleHeight;
            }
            else if (settings.lowerSelected)
            {
                radioButton3.Checked = true;
                textBoxHeight.Text   = settings.lowerHeight;
            }

            textBoxThickness.Text = settings.sampleThickness;
            textBoxDiameter.Text  = settings.diameter;
            textBoxViscosity.Text = settings.viscosity;

            //textBoxHeight.Text = settings.height;

            loadPathString();


            /* //new atira
             * //COMMS.openValve2();// we open valve 2 here so that the user has time to fill up the reservoir before starting the test
             * COMMS.closeValve2();
             * Thread.Sleep(800);
             * COMMS.openValve1();
             * Thread.Sleep(800);
             * COMMS.closeValve3();   */
        }
Пример #2
0
        private void FormManaul_Load(object sender, EventArgs e)
        {
            testStopped = false;
            if (settings.upperSelected)
            {
                radioButton1.Checked = true;
                textBoxHeight.Text   = settings.upperHeight;
            }
            else if (settings.middleSelected)
            {
                radioButton2.Checked = true;
                textBoxHeight.Text   = settings.middleHeight;
            }
            else if (settings.lowerSelected)
            {
                radioButton3.Checked = true;
                textBoxHeight.Text   = settings.lowerHeight;
            }

            textBoxThickness.Text = settings.sampleThickness;
            textBoxDiameter.Text  = settings.diameter;
            textBoxViscosity.Text = settings.viscosity;
            //textBoxHeight.Text = settings.height;


            if (settings.checkBoxZeroScale)
            {
                checkBoxZeroScale.Checked = true;
            }
            else
            {
                checkBoxZeroScale.Checked = false;
            }


            COMMS.autoFindPort();
            //COMMS.openSerial("COM3");
            //MessageBox.Show(serialPort1.IsOpen.ToString());

            if (COMMS.connected == false)
            {
                Close();
            }
            //scaleReading = COMMS.ReadScaleAWSContinuous().ToString(); //reads the first weight value which will be first data point.

            /*
             * try
             * {
             * originalWeight = Convert.ToDouble(scaleReading);
             * }
             * catch (Exception)
             * {
             * Debug.WriteLine("ERROR CONVERTING ORIGINAL scaleReading to DOUBLE");
             * originalWeight = 0;
             * }*/


            currentNetWeight = 0;
            loadPathString();
            textBox1.Text            = settings.dataAcquisitionInterval.ToString();
            checkBoxSaveData.Checked = settings.checkBoxSaveData;

            //enable this next line when ready!!!!!!!!!!!!!!!!
            //timerReadScale.Start();
            if (backgroundWorkerReadScale.IsBusy != true)
            {
                backgroundWorkerReadScale.RunWorkerAsync();
            }

            //chart1.Series["Series1"].Points.AddXY(String.Format("{0:#0.00}", 0), 0);
            chart1.Series["Series1"].BorderWidth = myBorderWidth;
        }