void devNotifier_OnDeviceNotify(object sender, DeviceNotifyEventArgs e) { Console.WriteLine(e.ToString()); switch (e.EventType) { case EventType.CustomEvent: break; case EventType.DeviceArrival: if (e.DeviceType == DeviceType.DeviceInterface) { this.Dispatcher.BeginInvoke(new AppendNotifyDelegate(UpStatusbarInfo), "Connected", e.Device); _UsbKeyDataStruct.PID = e.Device.IdProduct; _UsbKeyDataStruct.VID = e.Device.IdVendor; _UsbKeyDataStruct.Sn = System.Text.Encoding.ASCII.GetBytes(e.Device.SerialNumber); } break; case EventType.DeviceQueryRemove: break; case EventType.DeviceQueryRemoveFailed: break; case EventType.DeviceRemoveComplete: this.Dispatcher.BeginInvoke(new AppendNotifyDelegate(UpStatusbarInfo), "Disconnected", e.Device); break; case EventType.DeviceRemovePending: break; case EventType.DeviceTypeSpecific: break; default: break; } }
private void OnDeviceNotifyEvent(object sender, DeviceNotifyEventArgs e) { Console.WriteLine(e.ToString()); // Dump the event info to output. Console.WriteLine(); OnUsbDeviceAdded(); }
private static void OnDeviceNotifyEvent(object sender, DeviceNotifyEventArgs e) { // A Device system-level event has occured Console.SetCursorPosition(0,Console.CursorTop); Console.WriteLine(e.ToString()); // Dump the event info to output. Console.WriteLine(); Console.Write("[Press any key to exit]"); }
private void onDevNotify(object sender, DeviceNotifyEventArgs e) { Invoke(new AppendNotifyDelegate(AppendNotifyText),new object[] {e.ToString()}); }
void devNotifier_OnDeviceNotify(object sender, DeviceNotifyEventArgs e) { Console.WriteLine(e.ToString()); }
private void OnDeviceNotifyEvent(object sender, DeviceNotifyEventArgs e) { // Dump the event info to output. textBox1.Invoke(new EventHandler(delegate { textBox1.AppendText("\n#############\n"); })); textBox1.Invoke(new EventHandler(delegate { textBox1.AppendText(e.ToString()); })); label1.Text = e.Device.SerialNumber + " " + e.EventType.ToString(); label2.Text = e.Device.IdProduct.ToString() + e.Device.IdVendor.ToString(); textBox1.Invoke(new EventHandler(delegate { textBox1.AppendText("\n#############\n"); })); }