public void CheckDevicePresent() { try { bool flag = false; if (this.specified_device != null) { flag = true; } this.specified_device = UsbLibrary.SpecifiedDevice.FindSpecifiedDevice(this.vendor_id, this.product_id); if (this.specified_device != null) { if (this.OnSpecifiedDeviceArrived != null) { this.OnSpecifiedDeviceArrived(this, new EventArgs()); this.specified_device.DataSend += new DataSendEventHandler(this.OnDataSend.Invoke); this.specified_device.DataRecieved += new DataRecievedEventHandler(this.OnDataRecieved.Invoke); } } else if ((this.OnSpecifiedDeviceRemoved != null) && flag) { this.OnSpecifiedDeviceRemoved(this, new EventArgs()); } } catch (Exception exception) { Console.WriteLine(exception.ToString()); } }
public UsbHidPort() { this.product_id = 0; this.vendor_id = 0; this.specified_device = null; this.device_class = Win32Usb.HIDGuid; this.InitializeComponent(); }
public UsbHidPort(IContainer container) { this.product_id = 0; this.vendor_id = 0; this.specified_device = null; this.device_class = Win32Usb.HIDGuid; container.Add(this); this.InitializeComponent(); }