private void InitializeSDLScanner() { scanner = BarcodeScannerMoto.CreateInstance(); if (scanner == null) { MessageBox.Show("No scan engine found to claim", "Error", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1); trigPull.Enabled = btscan.Enabled = false; } else { scanner.Decoded += new EventHandler(SDLScanner_onDecoded); } }
private void FrBarCode_Closed(object sender, EventArgs e) { try { if (scanner != null) { scanner.Decoded -= new EventHandler(SDLScanner_onDecoded); scanner.Dispose(); scanner.Release(); scanner = null; } } catch { } }