Works Great!

Mar 10, 2011 at 11:48 AM

I found and implemented this barcode scanning code into a WP7 app in less than 30 minutes.  Thank you so much!

I wanted to handle the WP7 code myself so I just utilized the MultiFormatOneDReader to read and scan the barcode.

var image = new BitmapImage (); 


photoStream.Position = 0;

imgBarcode.Source = image;



var b = new WriteableBitmap

(image.PixelWidth, image.PixelHeight);







var reader = new MultiFormatOneDReader(null );


var result = reader.decode(new BinaryBitmap(

new HybridBinarizer(new RGBLuminanceSource(b, image.PixelWidth, image.PixelHeight))));

Mar 11, 2011 at 8:05 PM

Glad you like it! I know that some developers will want to have full control over the barcode scanning process, which is why I kept the standard ZXing code in a separate assembly. If you have any questions about how to use the ZXing API you can check out the Project Wiki or post a question in the ZXing Google Group.

If you want a more automated approach or just need to see some sample code you can look at the WP7BarcodeManager class, which handles taking the picture and processing the results. I've been working on optimizing the scanning process so that as much as possible occurs on a background thread, but you have to watch out for issues with creating BitmapImages and other gotchas.

I hope to release another version in the next few weeks but there are still plenty of bugs to be fixed (like DataMatrix support), so if you find any issues please use the issue tracker or better yet submit a patch!