public WiaConfiguration Wia10NativeUi(string deviceId, IntPtr hwnd) { try { try { using (var deviceManager = new WiaDeviceManager(WiaVersion.Wia10)) using (var device = deviceManager.FindDevice(deviceId)) { var item = device.PromptToConfigure(hwnd); return(new WiaConfiguration { DeviceProps = device.Properties.SerializeEditable(), ItemProps = item.Properties.SerializeEditable(), ItemName = item.Name() }); } } catch (WiaException e) { WiaScanErrors.ThrowDeviceError(e); throw new InvalidOperationException(); } } catch (ScanDriverException e) { throw new FaultException <ScanDriverExceptionDetail>(new ScanDriverExceptionDetail(e)); } }
private void Scan(ScannedImageSource.Concrete source) { using (var deviceManager = new WiaDeviceManager(ScanProfile.WiaVersion)) using (var device = deviceManager.FindDevice(ScanProfile.Device.ID)) { if (device.Version == WiaVersion.Wia20 && ScanProfile.UseNativeUI) { DoWia20NativeTransfer(source, deviceManager, device); return; } using (var item = GetItem(device)) { if (item == null) { return; } DoTransfer(source, device, item); } } }