public MainWindow() { InitializeComponent(); // Create the USB reference device object (passing VID and PID) usbController = new usbDevice(0x04D8, 0x0045); // Add a listener for usb events usbController.usbEvent += new usbDevice.usbEventsHandler(usbEvent_receiver); // Perform an initial search for the target device usbController.findTargetDevice(); }
private void btConnect_Click(object sender, RoutedEventArgs e) { // search for the USB device and connect if available usbController.findTargetDevice(); if (usbController.getDeviceStatus()) { this.lblStatus.Content = "Connected"; } else { this.lblStatus.Content = "Connection Failed"; } }
public MainWindow() { InitializeComponent(); dispatcherTimer.Tick += dispatcherTimer_Tick; dispatcherTimer.Interval = new TimeSpan(0, 0, 1); // Create the USB reference device object (passing VID and PID) usbController = new usbDevice(0x04D8, 0x0045); // Add a listener for usb events usbController.usbEvent += new usbDevice.usbEventsHandler(usbEvent_receiver); // Perform an initial search for the target device usbController.findTargetDevice(); }