コード例 #1
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         m_usb.Dispose();
     }
 }
コード例 #2
0
 public bool CommandCheckInitPort()
 {
     if ((m_strDeviceSelected == "") ||
         (m_strDeviceSelected == null))
     {
         RefreshAllDevice();
         if (m_listDeviceDescription.Count > 0)
         {
             m_strDeviceSelected = m_listDeviceDescription[0].DevicePath;
         }
     }
     if (!IsConnectOnline) //未打开
     {
         if (!Init())      //尝试打开,失败就提示
         {
             hidDevice.Dispose();
             throw new Exception("errCOMNoConnect");
         }
     }
     return(true);
 }
コード例 #3
0
 /// <summary>
 /// 检查设备连接情况
 /// </summary>
 /// <returns></returns>
 private bool CheckInitPort()
 {
     if ((m_strDeviceSelected == "") ||
         (m_strDeviceSelected == null))
     {
         throw new Exception("未设置设备连接字符串");
     }
     if (!IsConnectOnline) //未打开
     {
         if (!Init())      //尝试打开,失败就提示
         {
             hidDevice.Dispose();
             throw new Exception("尝试设备连接失败");
         }
     }
     return(true);
 }