private void btnRestart_Click(object sender, EventArgs e) { ListBoxImageScanned.Items.Clear(); images.Clear(); List <Bitmap> scanResult = Scan.StartScan(); images.AddRange(scanResult); }
private void btnContinue_Click(object sender, EventArgs e) { List <Bitmap> scanResult = Scan.StartScan(); int currentImages = images.Count; images.AddRange(scanResult); for (int i = currentImages; i < images.Count; i++) { ListBoxImageScanned.Items.Add("Image " + i); } }
public static void ReadDevice() { if (usbDevice == null) { Program.ShowError("Open device before trying to read."); } // open read endpoint 1. UsbEndpointReader reader = usbDevice.OpenEndpointReader(ReadEndpointID.Ep01); Logger.Log("Starting listening to device endpoint " + reader.EpNum); try { run = true; ErrorCode ec = ErrorCode.None; byte[] readBuffer = new byte[128]; while (usbDevice != null && run) { int bytesRead; // If the device hasn't sent data in the last 5 seconds, // a timeout error (ec = IoTimedOut) will occur. ec = reader.Read(readBuffer, Program.config.ButtonReadSize, out bytesRead); // Start scan on signal. if (ec == ErrorCode.None && bytesRead != 0) { Logger.Log("Received button signal"); Scan.StartScan(); } } } finally { run = false; CloseDevice(); } }
private void bt_testScanner_Click(object sender, EventArgs e) { Scan.StartScan(); }