Ejemplo n.º 1
0
        void Launch()
        {
            pass = false;
            fail = false;


            myDmm = new MeasureVoltage();

            dcVoltage1 = Math.Abs(myDmm.Measure());

            if (dcVoltage1 == 0.00000000)
            {
                meterConnected    = false;
                SerialNumber.Text = "";

                MessageBox.Show("Connect Meter USB");
            }

            else
            {
                meterConnected = true;
                BackgroundWorker bg = new BackgroundWorker();
                bg.DoWork             += Bg_DoWork;
                bg.RunWorkerCompleted += Bg_RunWorkerCompleted;
                bg.RunWorkerAsync();
            }
        }
Ejemplo n.º 2
0
        bool Measure2(MeasureVoltage dmm)
        {
            dcVoltage2 = 0.0;
            double reading;
            int    i;

            for (i = 1; i <= 5; i++)
            {
                reading = Math.Abs(dmm.Measure());

                dcVoltage2 = (dcVoltage2 + reading);
                Application.Current.Dispatcher.Invoke(() => Voltages2.Add(Convert.ToString(reading + " Volts")));
                if (reading == 0.00)
                {
                    Application.Current.Dispatcher.Invoke(() => MessageBox.Show("Connect Meter USB"));
                    TurnOffPower(power);
                    meterConnected = false;
                    return(false);
                }
                if (reading < 340 || reading > 375)
                {
                    dcVoltage2 = reading;
                    return(false);
                }
            }
            dcVoltage2 = dcVoltage2 / (i - 1);
            return(true);
        }