如何从 WPF 访问 Windows.Devices.Scanners
How to access Windows.Devices.Scanners from WPF
我需要从我的 WPF 应用程序中的扫描仪获取图像。我使用了开源 TwainDotNet Twain32 包装器,但是,有些 Windows 8.1 设备会抛出 AccessViolationException。我想在 Windows.Devices.Scanners 命名空间中使用最新的 Microsoft 支持的 WIA 包装器,而不是购买产品以在 Windows 8.1+ 机器上启用扫描。
我已经能够通过以下说明在 WPF 应用程序中成功使用某些 Windows.Devices.* 类型进行视频录制:How to use specific WinRT API from Desktop apps: capturing a photo using your webcam into a WPF app
当您查看 Windows.Devices.Scanners ImageScanner class 的文档时,您可以看到支持的最低客户端是 Windows 8.1 [Windows 应用商店,桌面应用程序]。由于它对 Windows 商店应用程序和桌面应用程序都可用,这意味着您应该能够从 WPF 中使用此命名空间和关联的 类。元数据列为 Windows.winmd,我相信它已在项目中引用(对 Windows 的引用),如上面的教程所述。
我的问题:如何在 Windows 8.x+ 上的 WPF 应用程序 运行 中使用 Windows.Devices.Scanners 类型?
提前感谢所有回复
文档指出支持的最低客户端是 Windows 8.1。您使用的教程告诉您编辑 CSPROJ 文件以添加以下代码:
<TargetPlatformVersion>8.0</TargetPlatformVersion>
将此更改为 8.1 以便仅引用 8.1 类型:
<TargetPlatformVersion>8.1</TargetPlatformVersion>
我需要从我的 WPF 应用程序中的扫描仪获取图像。我使用了开源 TwainDotNet Twain32 包装器,但是,有些 Windows 8.1 设备会抛出 AccessViolationException。我想在 Windows.Devices.Scanners 命名空间中使用最新的 Microsoft 支持的 WIA 包装器,而不是购买产品以在 Windows 8.1+ 机器上启用扫描。
我已经能够通过以下说明在 WPF 应用程序中成功使用某些 Windows.Devices.* 类型进行视频录制:How to use specific WinRT API from Desktop apps: capturing a photo using your webcam into a WPF app
当您查看 Windows.Devices.Scanners ImageScanner class 的文档时,您可以看到支持的最低客户端是 Windows 8.1 [Windows 应用商店,桌面应用程序]。由于它对 Windows 商店应用程序和桌面应用程序都可用,这意味着您应该能够从 WPF 中使用此命名空间和关联的 类。元数据列为 Windows.winmd,我相信它已在项目中引用(对 Windows 的引用),如上面的教程所述。
我的问题:如何在 Windows 8.x+ 上的 WPF 应用程序 运行 中使用 Windows.Devices.Scanners 类型?
提前感谢所有回复
文档指出支持的最低客户端是 Windows 8.1。您使用的教程告诉您编辑 CSPROJ 文件以添加以下代码:
<TargetPlatformVersion>8.0</TargetPlatformVersion>
将此更改为 8.1 以便仅引用 8.1 类型:
<TargetPlatformVersion>8.1</TargetPlatformVersion>