Пример #1
0
        private void Connect()
        {
            HIDInfoSet device;

            if (m_connList.Count == 0)
            {
                return;
            }

            device = m_connList[m_ToolStripComboBox.SelectedIndex];
            if (HIDDevice.GetInfoSets(device.VendorID, device.ProductID, device.SerialNumberString).Count > 0)
            {
                if (m_usb.Connect(device.DevicePath, true))
                {
                    LogDataGridView.Enabled           = true;
                    ConnectToolStripButton.Text       = "Disconnect";
                    ConnectToolStripButton.Image      = Properties.Resources.Disconnect;
                    m_ToolStripComboBox.Enabled       = false;
                    m_ToolStripStatusString.Text      = "USB Device connected";
                    m_ToolStripStatusString.ForeColor = Color.DarkSlateGray;
                    m_ToolStripStatusIcon.Image       = Properties.Resources.USB_OK;
                    m_ToolStripStatusIcon.ToolTipText = "Manufacturer: " + m_usb.ManufacturerString + "\n" +
                                                        "Product Name: " + m_usb.ProductString + "\n" +
                                                        "Serial Number: " + m_usb.SerialNumberString + "\n" +
                                                        "SW Version: " + m_usb.VersionInBCD;
                }
            }
            else
            {
                ScanConnection();
                MessageBox.Show(String.Format("DEVICE: {0} is used in other program !", device.ProductString), "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Пример #2
0
        private void Connect()
        {
            HIDInfoSet device;

            if (m_connList.Count == 0)
            {
                return;
            }

            device = m_connList[0];
            if (HIDDevice.GetInfoSets(device.VendorID, device.ProductID, device.SerialNumberString).Count > 0)
            {
                if (m_usb.Connect(device.DevicePath, true))
                {
                    //lbConnectionText.Text = "Connected";

                    //pbLED.Image = Properties.Resources.ledgreen;

                    IsMuted = false;

                    /*m_ToolStripStatusIcon.ToolTipText = "Manufacturer: " + m_usb.ManufacturerString + "\n" +
                     *                                  "Product Name: " + m_usb.ProductString + "\n" +
                     *                                  "Serial Number: " + m_usb.SerialNumberString + "\n" +
                     *                                  "SW Version: " + m_usb.VersionInBCD; */
                }
            }
            else
            {
                ScanConnection();
                MessageBox.Show(String.Format("DEVICE: {0} is used in other program !", device.ProductString));
            }
        }
Пример #3
0
 private void BeginConnect(string strDeviceDescription)
 {
     hidDevice.Connect(strDeviceDescription, true);
 }