Beispiel #1
0
        public AdvancedForm(OBDIfEx obdIfEX, OBDTest obdTest)
        {
            InitializeComponent();
            _obdIfEx = obdIfEX;
            _obdTest = obdTest;
            _obdIfEx.OBDIf.OnConnect    += new OBDInterface.__Delegate_OnConnect(On_OBD_Connect);
            _obdIfEx.OBDIf.OnDisconnect += new OBDInterface.__Delegate_OnDisconnect(On_OBD_Disconnect);

            _originFont = buttonDefaultFontStyle.Font;
            _boldFont   = new Font(_originFont, FontStyle.Bold);

            StatusLabelConnStatus.ForeColor = Color.Red;
            StatusLabelConnStatus.Text      = "OBD通讯接口未连接";
            StatusLabelDeviceName.Text      = "未获取到设备名";
            StatusLabelCommProtocol.Text    = _obdIfEx.OBDIf.GetProtocol().ToString();
            StatusLabelDeviceType.Text      = _obdIfEx.OBDIf.GetDevice().ToString().Replace("ELM327", "SH-VCI-302U");
            if (_obdIfEx.OBDIf.DllSettings != null)
            {
                if (_obdIfEx.OBDIf.DllSettings.AutoDetect)
                {
                    StatusLabelPort.Text        = "自动探测";
                    StatusLabelAppProtocol.Text = "自动探测";
                }
                else
                {
                    StatusLabelPort.Text        = _obdIfEx.OBDIf.DllSettings.ComPortName;
                    StatusLabelAppProtocol.Text = _obdIfEx.OBDIf.DllSettings.StandardName;
                }
            }

            InitSubForm();
            this.Text = "SH_OBD - Ver " + MainFileVersion.AssemblyVersion;
        }
Beispiel #2
0
 public OBDTestForm(OBDIfEx obdIfEx, OBDTest obdTest)
 {
     InitializeComponent();
     _obdIfEx = obdIfEx;
     _obdTest = obdTest;
     btnStartOBDTest.Enabled = false;
 }
Beispiel #3
0
        public MainWindow()
        {
            InitializeComponent();
            Title         += " Ver(Main/Dll): " + MainFileVersion.AssemblyVersion + "/" + DllVersion <SH_OBD_Dll> .AssemblyVersion;
            _serialRecvBuf = "";
            _bCanOBDTest   = true;
            _lastHeight    = Height;
            _obdIfEx       = new OBDIfEx();
            if (_obdIfEx.StrLoadConfigResult.Length > 0)
            {
                _obdIfEx.StrLoadConfigResult += "是否要以默认配置运行程序?点击\"否\":将会退出程序。";
                MessageBoxResult result = HandyControl.Controls.MessageBox.Ask(_obdIfEx.StrLoadConfigResult, "加载配置文件出错");
                if (result == MessageBoxResult.No)
                {
                    Environment.Exit(0);
                }
            }
            _obdTest = new OBDTest(_obdIfEx);
            if (_obdIfEx.ScannerPortOpened)
            {
                _obdIfEx.ScannerSP.DataReceived += new SerialPortClass.SerialPortDataReceiveEventArgs(SerialDataReceived);
            }
            _obdTest.OBDTestStart     += new Action(OnOBDTestStart);
            _obdTest.SetupColumnsDone += new Action(OnSetupColumnsDone);
            _obdTest.WriteDbStart     += new Action(OnWriteDbStart);
            _obdTest.WriteDbDone      += new Action(OnWriteDbDone);

            // 测试本地数据库连接是否正常
            Task.Factory.StartNew(TestNativeDatabase);
        }
Beispiel #4
0
 public AdvancedWindow(OBDIfEx _obdIfEx, OBDTest _obdTest)
 {
     InitializeComponent();
     Title           += " Ver(Main/Dll): " + MainFileVersion.AssemblyVersion + "/" + DllVersion <SH_OBD_Dll> .AssemblyVersion;
     tabView.Content  = new DataViewUC(_obdIfEx, _obdTest);
     tabCheck.Content = new CheckUC(_obdTest.DbLocal, _obdIfEx.Log);
 }
Beispiel #5
0
 public StatisticForm(OBDTest obdTest)
 {
     InitializeComponent();
     _dtContent = new DataTable("OBDData");
     _dtContent.Columns.Add("WriteTime");
     _dtContent.Columns.Add("VIN");
     _dtContent.Columns.Add("Result");
     _dtContent.Columns.Add("Upload");
     _obdTest     = obdTest;
     _allQty      = 0;
     _passedQty   = 0;
     _uploadedQty = 0;
     _pageSize    = 500;
 }
Beispiel #6
0
        public OBDStartForm()
        {
            InitializeComponent();
            this.Text     += " Ver(Main/Dll): " + MainFileVersion.AssemblyVersion + "/" + DllVersion <SH_OBD_Dll> .AssemblyVersion;
            _bCanOBDTest   = true;
            _lastHeight    = this.Height;
            _serialRecvBuf = "";
            _obdIfEx       = new OBDIfEx();
            if (_obdIfEx.StrLoadConfigResult.Length > 0)
            {
                _obdIfEx.StrLoadConfigResult += "是否要以默认配置运行程序?点击\"否\":将会退出程序。";
                DialogResult result = MessageBox.Show(_obdIfEx.StrLoadConfigResult, "加载配置文件出错", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result == DialogResult.No)
                {
                    Environment.Exit(0);
                }
            }
            _obdTest   = new OBDTest(_obdIfEx);
            _backColor = lblVIN.BackColor;
            if (_obdIfEx.ScannerPortOpened)
            {
                _obdIfEx._sp.DataReceived += new SerialPortClass.SerialPortDataReceiveEventArgs(SerialDataReceived);
            }
            _obdTest.OBDTestStart     += new Action(OnOBDTestStart);
            _obdTest.SetupColumnsDone += new Action(OnSetupColumnsDone);
            _obdTest.WriteDbStart     += new Action(OnWriteDbStart);
            _obdTest.WriteDbDone      += new Action(OnWriteDbDone);
            _obdTest.UploadDataStart  += new Action(OnUploadDataStart);
            _obdTest.UploadDataDone   += new Action(OnUploadDataDone);
#if !DEBUG
            // 删除WebService上传接口缓存dll
            string dllPath = ".\\" + _obdIfEx.DBandMES.WSMES.Name + ".dll";
            try {
                if (File.Exists(dllPath))
                {
                    File.Delete(dllPath);
                }
            } catch (Exception ex) {
                _obdIfEx.Log.TraceError("Delete WebService dll file failed: " + ex.Message);
            }
#endif
            // 测试本地数据库连接是否正常
            Task.Factory.StartNew(TestNativeDatabase);

            // 定时上传以前上传失败的数据
            _timer           = new System.Timers.Timer(_obdIfEx.OBDResultSetting.UploadInterval * 60 * 1000);
            _timer.Elapsed  += new System.Timers.ElapsedEventHandler(OnTimeUpload);
            _timer.AutoReset = true;
            _timer.Enabled   = true;
        }
Beispiel #7
0
 public PwdWindow(OBDTest obdTest)
 {
     InitializeComponent();
     _obdTest = obdTest;
 }
Beispiel #8
0
 public PassWordForm(OBDTest obdTest)
 {
     InitializeComponent();
     _obdTest = obdTest;
 }
Beispiel #9
0
 public DataViewUC(OBDIfEx obdIfEx, OBDTest obdTest)
 {
     InitializeComponent();
     _obdIfEx = obdIfEx;
     _obdTest = obdTest;
 }