// PnpEventArgs: there is no way of telling which scanner attached / detached private static void OnScannerAttached(object sender, PnpEventArgs e) { log.Debug("Scanner attached"); Console.WriteLine("Scanner attached"); // if cradle detaches, when it reattaches this event handler gets called once for cradle, once for scanner. // only want to configure one time. // this needs to be handled for more scanners. Can set 10 second timer to delete oldScanners if (BarcodeScannerManager.Instance.GetDevices().Count > 1) { oldScannerInfo = scannerInfo; // every time scanner is attached, reconfigure all scanners, because there is no guarantee that scanner that has // previously detached has the same id when it reattaches, and we don't have the id of the scanner that has attached. ConfigureScanners(); } }
private static void Instance_ScannerDetached(object sender, PnpEventArgs e) { _scannerAttached = false; }
private static void Instance_ScannerAttached(object sender, PnpEventArgs e) { _scannerAttached = true; ConnectScanners(); }
private static void OnScannerDetached(object sender, PnpEventArgs e) { _log.Debug("Scanner detached"); Console.WriteLine("Scanner id=" + e.ScannerId + " detached"); }
// PnpEventArgs doesn't have scanner serial // there is no way of telling which scanner attached / detached private static void OnScannerAttached(object sender, PnpEventArgs e) { _log.Debug("Scanner attached"); ConfigureScanners(); Console.WriteLine("Scanner id=" + e.ScannerId + " attached"); }