【发布时间】:2013-11-08 01:02:48
【问题描述】:
您知道 Windows 8.1 是否附带本机/内置条形码扫描仪,还是我需要第三方库进行开发?
【问题讨论】:
-
没有。买一本,看说明书。
您知道 Windows 8.1 是否附带本机/内置条形码扫描仪,还是我需要第三方库进行开发?
【问题讨论】:
是的,在 Windows8.1 中有一个 BarCodeScanner 类可用(但在 Windows 8 中不可用)
MSDN 中也有一个代码示例 - http://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.pointofservice.barcodescanner.aspx
【讨论】:
不,Windows 8 没有内置对条形码识别的支持。您可以购买一些便宜的图书馆。还有一些开源项目。
我们在工作场所使用NeoDynamic Barcode。
这是来自How to read Barcode reader in windows 8的一段代码
var ccu = new Windows.Media.Capture.CameraCaptureUI();
ccu.PhotoSettings.Format = CameraCaptureUIPhotoFormat.Jpeg;
ccu.PhotoSettings.MaxResolution = CameraCaptureUIMaxPhotoResolution.HighestAvailable;
Windows.Storage.StorageFile x = await ccu.CaptureFileAsync(CameraCaptureUIMode.Photo);
//FileOpenPicker fop = new FileOpenPicker();
//fop.FileTypeFilter.Add(".jpg");
//StorageFile x = await fop.PickSingleFileAsync();
if (x != null)
{
ZXing.BarcodeReader br = new ZXing.BarcodeReader();
WriteableBitmap wrb;
BitmapImage img = new BitmapImage();
img.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
using (IRandomAccessStream fileStream = await x.OpenAsync(FileAccessMode.Read))
{
//fileStream.
wrb = await BitmapFactory.New(1, 1).FromStream(fileStream);
}
var res = br.Decode(wrb);
testImage.Source = wrb;
//System.Diagnostics.Debug.WriteLine("ISBN = " + res.ToString());
}
完整参考:http://zxingnet.codeplex.com/discussions/393332
注意:请添加来自http://zxingnet.codeplex.com/的引用zxing.winrt和WriteableBitmapEx.WinRT
【讨论】: