コード例 #1
0
        private void UpdateStatusBar(object sender, string msg)
        {
            if (msg == "newvalue")
            {
                RX_VAR rv = task.currRx.var;

                AddValue(task.currRx.iChan.ToString(), task.iMeasCnt, rv.rRx, 0, 0);

                lbl_aux1.Text    = UpdateDisplayReading(aux1_mode);
                lbl_aux2.Text    = UpdateDisplayReading(aux2_mode);
                lbl_bigdisp.Text = UpdateDisplayReading(bigdisp_mode);
                DeviceMgr.ReportData(task.iMeasCnt, rv.rRx);
                LogData(task.iMeasCnt, rv.rRx);

                /*
                 * statusBar1.total = syscfg.iMeasTimes;
                 * statusBar1.count = task.iMeasCnt;
                 */
            }
            else if (msg == "complete")
            {
                if (runstate.NumOfRunsLeft > 0)
                {
                    DoNextMeasure();
                }
                else
                {
                    if (Program.sysinfo.bThrow)
                    {
                        ThrowData();
                    }
                    LogComplete();
                    bt_run.Text    = StringResource.str("start");
                    btn_menu.Label = StringResource.str("menu");
                }
            }
            else
            {
                string txt = StringResource.str(msg);
                if (txt == msg)
                {
                    MsgDlg.Show(task.currRx.var.errMsg);
                }
                else
                {
                    bt_run.Text = txt;
                }
            }
        }
コード例 #2
0
 void UpdateStatusBar(object sender, string msg)
 {
     if (msg == "newvalue")
     {
         RX_VAR rv = task.currRx.var;
         rxDisplay1.AddValue(task.iMeasCnt, rv.rRx);
         DeviceMgr.ReportData(task.iMeasCnt, rv.rRx);
         rxDisplay1.LogData(task.iMeasCnt, rv.rRx);
         statusBar1.total = syscfg.iMeasTimes;
         statusBar1.count = task.iMeasCnt;
     }
     if (msg == "complete")
     {
         if (RunWnd.syscfg.bThrow)
         {
             rxDisplay1.ThrowData();
         }
         rxDisplay1.LogComplete();
     }
     statusBar1.status  = task.currRx.i_State;
     statusBar1.message = task.currRx.var.errMsg;
 }
コード例 #3
0
        public void pc_cmd(string cmd)
        {
            SysConfig syscfg = Program.sysinfo;

            if (cmd == "S")
            {
                task.Stop();//STOP; need reply //todo
                return;
            }
            if (cmd == "H")
            {
//                DeviceMgr.Reset();//reset
                return;
            }
            Match m;

            m = reg_mode.Match(cmd);
            if (m.Success)
            {
                oper_mode = m.Groups[1].Value;
                return;
            }
            m = reg_statistic.Match(cmd);
            if (m.Success)
            {
                syscfg.iFilter = Convert.ToInt32(m.Groups[1].Value);
                return;
            }
            m = reg_filter.Match(cmd);
            if (m.Success)
            {
                if (m.Groups[1].Value == "2")
                {
                    syscfg.sFilterType = "filtertype3";
                }
                else if (m.Groups[1].Value == "1")
                {
                    syscfg.sFilterType = "filtertype2";
                }
                else
                {
                    syscfg.sFilterType = "filtertype1";
                }
                return;
            }
            m = reg_ix.Match(cmd);
            if (m.Success)
            {/*
              * //todo
              * if (currRx.iIx == 0) //1mA
              * if (currRx.iIx == 1) //10mA
              * if (currRx.iIx == 2) //0.1A
              * if (currRx.iIx == 3) //0.3A
              * if (currRx.iIx == 4) //1A
              * if (currRx.iIx == 5) //5A
              */
                double myIx = double.Parse(m.Groups[1].Value) / 1000;
                if (myIx >= 3)
                {
                    Program.lst_rxinfo[0].iIx = 5;
                }
                else if (myIx >= 0.65)
                {
                    Program.lst_rxinfo[0].iIx = 4;
                }
                else if (myIx >= 0.2)
                {
                    Program.lst_rxinfo[0].iIx = 3;
                }
                else if (myIx >= 0.05)
                {
                    Program.lst_rxinfo[0].iIx = 2;
                }
                else if (myIx >= 0.005)
                {
                    Program.lst_rxinfo[0].iIx = 1;
                }
                else if (myIx >= 0.0005)
                {
                    Program.lst_rxinfo[0].iIx = 0;
                }
                else
                {
                    Program.lst_rxinfo[0].iIx = -1;
                }
                return;
            }
            m = reg_delay.Match(cmd);
            if (m.Success)
            {
                syscfg.iMeasDelay = Convert.ToInt32(m.Groups[1].Value);
                return;
            }
            m = reg_meastimes.Match(cmd);
            if (m.Success)
            {
                syscfg.iMeasTimes = Convert.ToInt32(m.Groups[1].Value);
                return;
            }
            m = reg_sampletimes.Match(cmd);
            if (m.Success)
            {
                syscfg.iSampleTimes = Convert.ToInt32(m.Groups[1].Value);
                return;
            }
            m = reg_measure.Match(cmd);
            if (m.Success)
            {
                syscfg.iMeasTimes = Convert.ToInt32(m.Groups[1].Value);
                Program.mainwnd.Invoke(new Action <object, EventArgs>(this.statusBar1_StartStopClick), new object[] { 0, 0 });
                //task.Start();
                return;
            }
            m = reg_rsa.Match(cmd);
            if (m.Success) //A mode
            {
                Program.lst_rsinfo[0].dValue   = Convert.ToDouble(m.Groups[1].Value);
                Program.lst_rxinfo[0].cStdChan = 'A';
                DeviceMgr.ReportHeader(syscfg.iMeasTimes);
                for (int i = 0; i < syscfg.iMeasTimes; i++)
                {
                    DeviceMgr.ReportData(i + 1, 10.01234566);
                    Thread.Sleep(1000);
                }
                return;
            }
            m = reg_rsb.Match(cmd);
            if (m.Success) //B mode
            {
                Program.lst_rsinfo[0].dValue   = Convert.ToDouble(m.Groups[1].Value);
                Program.lst_rxinfo[0].cStdChan = 'B';
                return;
            }
        }