Ejemplo n.º 1
0
        private void simpleButton14_Click(object sender, EventArgs e)
        {
            WaitDialogForm wdf = new WaitDialogForm("命令执行中,请稍候......");

            try
            {
                GetGasFromControl();
                GasInstruction.WriteChromaAndAD(Gas, EnumChromaLevel.Zero, Gloab.AllData.Address, CommandCallback);
                Callback("写入零点成功");
            }
            catch (CommandException ex)
            {
                Callback("写入零点失败");
                XtraMessageBox.Show(ex.Message);
            }
            catch (Exception ecp)
            {
                Callback("写入零点失败");
                log.Error(ecp);
            }
            finally
            {
                wdf.Close();
            }
        }
Ejemplo n.º 2
0
        private void simpleButton15_Click(object sender, EventArgs e)
        {
            WaitDialogForm wdf = new WaitDialogForm("命令执行中,请稍候......");

            try
            {
                GasEntity ge = GasInstruction.ReadChromaAndAD(GasID, EnumChromaLevel.Zero, Gloab.AllData.Address, CommandCallback);
                Gas.ZeroChroma = ge.ZeroChroma;
                Gas.ZeroAD     = ge.ZeroAD;
                SetGasToControl();
                Callback("读取零点成功");
            }
            catch (CommandException ex)
            {
                Callback("读取零点失败");
                XtraMessageBox.Show(ex.Message);
            }
            catch (Exception ecp)
            {
                Callback("读取零点失败");
                log.Error(ecp);
            }
            finally
            {
                wdf.Close();
            }
        }
Ejemplo n.º 3
0
 private void simpleButton16_Click(object sender, EventArgs e)
 {
     if (simpleButton16.Text == "采样")
     {
         if (CheckIsSampling())
         {
             return;
         }
         simpleButton16.Text = "停止";
         try
         {
             GasInstruction.StartSample(Gloab.AllData.Address, GasID, EnumChromaLevel.Zero, Sampling, CommandCallback);
             Callback("开始采样");
         }
         catch (CommandException ex)
         {
             Callback("采样失败");
             XtraMessageBox.Show(ex.Message);
             simpleButton16.Text = "采样";
         }
         catch (Exception ecp)
         {
             log.Error(ecp);
             simpleButton16.Text = "采样";
             Callback("采样失败");
         }
     }
     else
     {
         GasInstruction.StopSample();
         simpleButton16.Text = "采样";
         Callback("停止采样");
     }
 }
Ejemplo n.º 4
0
        private void simpleButton12_Click(object sender, EventArgs e)
        {
            WaitDialogForm wdf = new WaitDialogForm("命令执行中,请稍候......");

            try
            {
                GetGasFromControl();
                GasInstruction.WriteGas(Gas, Gloab.AllData.Address, CommandCallback);
                Callback(string.Format("写入气体{0}成功", GasID));
                if (ChangeGasEvent != null)
                {
                    ChangeGasEvent(null, null);
                }
            }
            catch (CommandException ex)
            {
                Callback(string.Format("写入气体{0}失败", GasID));
                XtraMessageBox.Show(ex.Message);
            }
            catch (Exception ecp)
            {
                Callback(string.Format("写入气体{0}失败", GasID));
                log.Error(ecp);
            }
            finally
            {
                wdf.Close();
            }
        }
Ejemplo n.º 5
0
        private void simpleButton23_Click(object sender, EventArgs e)
        {
            WaitDialogForm wdf = new WaitDialogForm("命令执行中,请稍候......");

            try
            {
                Gloab.AllData.GasList         = GasInstruction.ReadGasList(Gloab.AllData.Address, Gloab.Config, CommandCallback);
                Gloab.AllData.Normal.GasCount = (short)Gloab.AllData.GasList.Count;
                SetGasToControl();
                SetDebugStr("读取全部气体成功");
            }
            catch (CommandException ex)
            {
                SetDebugStr("读取全部气体失败");
                XtraMessageBox.Show(ex.Message);
            }
            catch (Exception exp)
            {
                SetDebugStr("读取全部气体失败");
                log.Error(exp);
            }
            finally
            {
                wdf.Close();
            }
        }
Ejemplo n.º 6
0
        private void simpleButton11_Click(object sender, EventArgs e)
        {
            WaitDialogForm wdf = new WaitDialogForm("命令执行中,请稍候......");

            try
            {
                Gloab.AllData.GasList[Gloab.AllData.GasList.FindIndex(c => c.GasID == GasID)] = GasInstruction.ReadGas(GasID, Gloab.AllData.Address, Gloab.Config, CommandCallback);
                Gas = Gloab.AllData.GasList.Find(c => c.GasID == GasID);
                SetGasToControl();
                Callback(string.Format("读取气体{0}成功", GasID));
                if (ChangeGasEvent != null)
                {
                    ChangeGasEvent(null, null);
                }
            }
            catch (CommandException ex)
            {
                Callback(string.Format("读取气体{0}失败", GasID));

                XtraMessageBox.Show(ex.Message);
            }
            catch (Exception ecp)
            {
                Callback(string.Format("读取气体{0}失败", GasID));
                log.Error(ecp);
            }
            finally
            {
                wdf.Close();
            }
        }