示例#1
0
 public void CheckConnection()
 {
     if (m_obdInterface.ConnectedStatus)
     {
         string strID = m_obdInterface.GetDeviceIDString();
         if (strID.Contains("ELM327"))
         {
             m_strPmt = "ELM327 > ";
         }
         else if (strID.Contains("ELM323"))
         {
             m_strPmt = "ELM323 > ";
         }
         else if (strID.Contains("ELM322"))
         {
             m_strPmt = "ELM322 > ";
         }
         else if (strID.Contains("ELM320"))
         {
             m_strPmt = "ELM320 > ";
         }
     }
     else
     {
         m_strPmt = "ELM > ";
     }
     lblPrompt.Text = m_strPmt;
     if (m_obdInterface.ConnectedStatus)
     {
         richText.Text = richText.Text.Replace("ELM > ", m_strPmt);
     }
     ;
 }
示例#2
0
 private void On_OBD_Connect()
 {
     if (InvokeRequired)
     {
         this.Invoke((EventHandler) delegate {
             On_OBD_Connect();
         });
     }
     else
     {
         StatusLabelConnStatus.Text      = "OBD通讯接口已连接";
         StatusLabelConnStatus.ForeColor = Color.Green;
         StatusLabelDeviceName.Text      = m_obdInterface.GetDeviceIDString();
         StatusLabelCommProtocol.Text    = m_obdInterface.GetProtocol().ToString();
         toolStripBtnUserPrefs.Enabled   = false;
         toolStripBtnVehicles.Enabled    = false;
         toolStripBtnSettings.Enabled    = false;
         BroadcastConnectionUpdate();
     }
 }