String f = ((files.Max(p1 => Int32.Parse(Path.GetFileNameWithoutExtension(p1)))) + 1).ToString() įileName = txtPath.Text + " \\" + f + ". Var files = Directory.GetFiles(txtPath.Text, " *.tiff") Object scanResult = commonDialogClass.ShowTransfer(scannnerItem,, false) Item scannnerItem = scannerDevice.Items ĪdjustScannerSettings(scannnerItem, ( int)nudRes.Value, 0, 0, ( int)nudWidth.Value, ( int)nudHeight.Value, 0, 0, cmbCMIndex) Thread Process Code:ĬommonDialogClass commonDialogClass = new CommonDialogClass() ĭevice scannerDevice = commonDialogClass.ShowSelectDevice(WiaDeviceType.ScannerDeviceType, false, false)
#New hp 5590 scanner code#
In this event handler, we call our code that is being processed in the background where our application is still doing some other work. This event is fired when the RunWorkerAsync method is called. That will allow the interface to keep accepting new events like other button clicks.Īsynchronous Process Implementing Automatic ScanningĭoWork event is the starting point for a BackgroundWorker. If you used the background worker thread instead, the button event would setup the worker thread and return immediately. The difference in behavior is because the call to the background worker thread will not execute in the same thread as the interface, freeing it to continue its normal work. During that time, the interface will appear 'frozen': you won't be able to interact with it. Suppose you have something that takes 5 sec to compute when you click a button. The background worker thread is there to help to offload long running function calls to the background so that the interface will not freeze. If you were to run a lengthy process on the UI thread, your UI will most likely freeze until the process completes.
The BackgroundWorker is designed to let you run heavy or long operations on a separate thread to that of the UI. This UI thread is responsible for creating/painting all the controls and upon which the code execution takes place.
#New hp 5590 scanner windows#
For scanning the documents it takes too much time to scan upto 1000 pages.Ī basic Windows application runs on a single thread usually referred to as UI thread. Normally we can scan the documents using scanner application or WIA (Windows Image Acquisition) driver. We can easily and quickly scan bulk amount of documents (i.e 10,000 pages) with this application. This application automatically scans the document or photo from the scanner in some particular interval given by the user.