How To Wait On WIA CommonDialog.ShowAcquisitionWizard Method to Finish?
Asked Answered
C

0

6

I am trying to use WIA for scanning and am running into a little trouble. I am using the CommonDialog.ShowAcquisitionWizard method as documented on MSDN. The problem is, there is no object returned from the method. I need to know when the scanning is complete and I have tried multiple ways (Thread) and have failed. Can someone please suggest a method I should use to determine whether or not the scan is complete and/or the dialog is closed?

My current code:

private void DoScan()
{
    WIA.CommonDialog dialog = new WIA.CommonDialog();
    Device device = dialog.ShowSelectDevice(WiaDeviceType.ScannerDeviceType);
    dialog.ShowAcquisitionWizard(device);

    // immediately jumps to this line...
    string test = "is it done?";

    // if i put a breakpoint there, the WIA interface never appears, I have to continue before it will show.
    // so a threading.sleep(5000) won't work...
}
Customable answered 20/7, 2014 at 18:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.