二维码扫描主要基于谷歌的ZXing库的使用,ios在IOS7之后有自己自带的库。安卓、WP等设备环境都主要使用ZXing,下面简要记录下WP做二维码的经历
1.网上能找到,基于WP7的网上案例:
https://github.com/gzb1985/WP7BarcodeScannerExample
该案例基于旧版的Silverlight_ZXing_Core.dll的引用,案例代码存在一个缺陷。就系捕捉相机图像后解码时会报错,直接跳到Catch里。跳过了再次对焦的执行方法,导致下次捕捉图像时不能正常捕捉清晰的对象,从而导致不能扫描成功。稍微修改一下就行了
2.最新的Zxing.Net 14.0组件
2.1 组件可用于平台:
- .Net 2.0, 3.5 and 4.0
- Silverlight 4 and 5
- Windows Phone 7.0, 7.1 and 8.0
- Windows CE
- Windows RT Class Library and Runtime Components (winmd)
- Portable Class Library
- Unity3D (.Net 2.0 built without System.Drawing reference)
- Xamarin.Android (formerly Mono for Android)
2.2 支持解码格式:
UPC-A, UPC-E, EAN-8, EAN-13, Code 39, Code 93, Code 128, ITF, Codabar, MSI, RSS-14 (all variants), QR Code, Data Matrix, Aztec and PDF-417.
The encoder supports the following formats:
UPC-A, EAN-8, EAN-13, Code 39, Code 128, ITF, Codabar, Plessey, MSI, QR Code, PDF-417, Aztec, Data Matrix
2.3 地址:http://zxingnet.codeplex.com/
2.4 注意:和Silverlight_ZXing_Core.dll的案例使用差不多,函数名基本相同,部分使用地方有些少出入。详细使用代码不贴了,一般自己研究一下就OK了
3.注意解码格式:
有些条形码或二维码扫不出结果时,可改用其他格式解码尝试
可参考:http://www.cnblogs.com/622698abc/archive/2013/01/24/2875891.html