コード例 #1
0
 public int DevicesConnected()
 {
     //if only one device driver
     if (_numDevices == 1)
     {
         //return it
         _selectedDevice = (USBDevice)Webcams[0];
     }
     return(_numDevices);
 }
コード例 #2
0
 public void BtnConnect_Click(object sender, EventArgs e)
 {
     if (cboUSBDevices.SelectedIndex < 0)
     {
         MessageBox.Show("Please Select A Device");
     }
     else
     {
         //if more than one driver listed on the system return the selected one
         _selectedDevice = (USBDevice)Webcams[cboUSBDevices.SelectedIndex];
         Close();
     }
 }
コード例 #3
0
        public void GetAttachedUSBDevices()
        {
            string name    = "".PadRight(40);
            string version = "".PadRight(25);

            cboUSBDevices.Items.Clear();

            //we can have up to 10 usb devices or webcams
            for (int i = 0; i < 10; i++)
            {
                //get the driver details
                if (capGetDriverDescription(i, ref name, 40, ref version, 25))
                {
                    USBDevice webcam = new USBDevice();
                    webcam.Name    = name.Trim();
                    webcam.Version = version.Trim();
                    Webcams.Add(webcam);
                    cboUSBDevices.Items.Add(webcam);
                    _numDevices += 1;
                }
            }
            //cboUSBDevices.SelectedIndex = 0;
        }