示例#1
0
        private void Startup()
        {
            try
            {
                var myWinUsbCommunications = new WinUsbCommunications();
                _winUsbHandle = new WinUsbCommunications.SafeWinUsbHandle();
                DetectWindows81();
                //InitializeDisplay();
                DeviceNotificationsStart();

                FindMyDevice();

                Thread.Sleep(1000);
                // Create message polling thread.
                if (!UsbPipeReadTask.IsAlive)
                {
                    UsbPipeReadTask = new Thread(usbReadTask);      //On declare la tache de lecture usb
                    UsbPipeReadTask.Start();
                }
            }
            catch (Exception ex)
            {
                DisplayException(Name, ex);
                throw;
            }
        }
示例#2
0
        ///  <summary>
        ///  Get and display the device's speed in the list box.
        ///  </summary>

        private void DisplayDeviceSpeed(Device device)
        {
            try
            {
                var speed = "";

                if (device != null)
                {
                    WinUsbCommunications.QueryDeviceSpeed(device._winUsbHandle, ref device._myDeviceInfo);

                    switch (device._myDeviceInfo.DeviceSpeed)
                    {
                    case 1:
                        speed = "low or full speed";
                        break;

                    case 3:
                        speed = "high speed or SuperSpeed";
                        break;
                    }
                }

                //LstResults.Items.Add("Device is " + speed);   //Modif a decommenter 24/08/2015
                //MyMarshalToForm(FormActions.AddItemToListBox.ToString(), "Device is " + speed);
            }
            catch (Exception ex)
            {
                DisplayException(Name, ex);
                throw;
            }
        }