public static void wakeScanner(Button scanButton, TextBox textBox, bool scannerMode) { scanButton.Enabled = false; Symbol.Generic.Device MyDevice = Symbol.Barcode.Device.AvailableDevices[0]; Barcode2 MyBarcode = new Barcode2(MyDevice.ToString()); MyBarcode.Enable(); MyBarcode.Config.Reader.ReaderSpecific.LaserSpecific.AimDuration = 500; if (scannerMode) { MyBarcode.Config.TriggerMode = TRIGGERMODES.HARD; } else { MyBarcode.Config.TriggerMode = TRIGGERMODES.SOFT_ONCE; } ScanData MyData = MyBarcode.ScanWait(8000); // 5 seconds timeout if (MyData.Result == Symbol.Barcode2.Results.E_SCN_READTIMEOUT) // Barcode was not scanned within 8 secs { scanButton.Text = "No Scan Found"; textBox.Text = "No Scan Found"; MyBarcode.Dispose(); //enable add product button scanButton.Enabled = true; } if (MyData.Result == Symbol.Barcode2.Results.SUCCESS) // Barcode was scanned successfully { scanButton.Text = MyData.ToString(); textBox.Text = MyData.ToString(); MyBarcode.Dispose(); //enable add product button scanButton.Enabled = true; } }