如何等待WIA CommonDialog.ShowAcquisitionWizard方法完成?

时间:2014-07-20 18:54:38

标签: c# wia

我正在尝试使用WIA扫描并遇到一些麻烦。我正在使用MSDN中记录的CommonDialog.ShowAcquisitionWizard方法。问题是,该方法没有返回任何对象。我需要知道扫描何时完成,我尝试了多种方式(线程)并且失败了。有人可以建议我用来确定扫描是否完成和/或对话框关闭的方法吗?

我目前的代码:

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...
}

0 个答案:

没有答案