Getting an Instance of ImageScanner
Unlike the sensors and other devices, there is no API for retrieving a default image scanner. Instead, you must create one from a specific device ID using the static ImageScanner.FromIdAsync
method. If a scanner is connected, you can get its ID with APIs from the Windows.Devices.Enumeration
namespace. For example, you can enumerate available scanners as follows:
foreach (DeviceInformation deviceInfo in await DeviceInformation.FindAllAsync(DeviceClass.ImageScanner)) { // Examine each matching device }
You can also use DeviceWatcher
, which raises events as devices are added, removed, and updated.
The DeviceInformation
instances you get from these mechanisms expose the ...
Get Universal Windows® Apps with XAML and C# Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.