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;
}
}