Пример #1
0
 public FormStatistics(Temper tester)
 {
     InitializeComponent();
     m_tester = tester;
     m_log    = m_tester.GetLogger();
     m_cfg    = m_tester.GetConfig();
     m_db     = m_tester.GetModel();
     m_dtShow = new DataTable("Show");
     m_dtShow.Columns.Add("测温站ID");
     m_dtShow.Columns.Add("检测日期");
     m_dtShow.Columns.Add("检测时间");
     m_dtShow.Columns.Add("车辆VIN号");
     m_dtShow.Columns.Add("检测结果");
 }
Пример #2
0
 public Main()
 {
     InitializeComponent();
     m_bTesting      = false;
     m_lastHeight    = this.Height;
     m_serialRecvBuf = "";
     m_bLastStatus   = false;
     m_bBlink        = false;
     m_lockObj       = new object();
     m_counterFailed = 0;
     m_bLoop         = false;
     m_OBDInited     = false;
     m_inFinishing   = 0;
     this.Text       = Properties.Resources.MainTitle + " Ver: " + MainFileVersion.AssemblyVersion;
     m_log           = new BaseLib.Logger(".\\log\\Temper", BaseLib.EnumLogLevel.LogLevelAll, true, 100);
     m_log.TraceInfo("==================================================================");
     m_log.TraceInfo("===================== START Ver: " + MainFileVersion.AssemblyVersion + " =====================");
     m_cfg = new Config(m_log);
     try {
         m_cfg.LoadConfigAll();
     } catch (ApplicationException ex) {
         MessageBox.Show(ex.Message.Split(':')[0] + "配置文件读取出错,将会使用默认配置", "初始化错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     m_db     = new BaseLib.Model("TemperSensor", m_cfg, m_log);
     m_tester = new Temper(m_log, m_cfg, m_db);
     m_tester.TCPClientInit();
     if (!m_tester.GetInitStatus())
     {
         MessageBox.Show("无法连接WiFi串口服务器", "初始化错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     if (m_cfg.Setting.Data.ScannerPort.Length > 0)
     {
         m_sp = new BaseLib.SerialPortClass(
             m_cfg.Setting.Data.ScannerPort,
             m_cfg.Setting.Data.ScannerBaud,
             Parity.None,
             8,
             StopBits.One
             );
         try {
             m_sp.OpenPort();
             m_sp.DataReceived += new BaseLib.SerialPortClass.SerialPortDataReceiveEventArgs(SerialDataReceived);
         } catch (Exception ex) {
             m_log.TraceError("Open serial port error: " + ex.Message);
             MessageBox.Show("打开串口扫码枪出错", "初始化错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     m_obdDll                  = new OBDDll(m_log);
     m_timerInterval           = new System.Timers.Timer(m_cfg.Setting.Data.Interval);
     m_timerInterval.Elapsed  += new System.Timers.ElapsedEventHandler(OnTimeInterval);
     m_timerInterval.AutoReset = true;
     m_timerInterval.Enabled   = false;
     m_timerTick               = new System.Timers.Timer(m_cfg.Setting.Data.Interval); // 心跳间隔同采样间隔一致
     m_timerTick.Elapsed      += new System.Timers.ElapsedEventHandler(OnTimeTick);
     m_timerTick.AutoReset     = true;
     m_timerTick.Enabled       = true;
     m_timerBlink              = new System.Timers.Timer(m_cfg.Setting.Data.Interval); // 闪烁间隔同采样间隔一致
     m_timerBlink.Elapsed     += new System.Timers.ElapsedEventHandler(OnTimeBlink);
     m_timerBlink.AutoReset    = true;
     m_timerBlink.Enabled      = true;
 }