Sunday, 1 August 2010

WP7 ZXing Barcode

First of all I want to express my regret that I am not one of the 3.000 developers that received a WP 7 developer device (I read somewhere that there are more than 3.000 users that use Facebook from WP7). I really hoped to have a "real" device, but that's the way the cookie crumbles...
This weekend I had two days of WP 7 fun. What I've wanted to see was the use of ZXing in WP 7. There is already a C# port of the library in the ZXing trunk. Porting it to Silverlight it is quite simple (just have to replace ArrayList with generics lists and HashTable with Dictionary) more details here. So I've downloaded the latest csharp source code from ZXing trunk and compiled the library. This was the simple part because I wanted a "nice" test project. I've used the test images from the ZXing source zip as embedded resources and the gesture recognizer from Clarity Consulting this way the user is able to flick both direction between the test images. It was a project based learning because I've used MVVM and the application was following the pattern till I've ruined it with the CameraCaptureTask and PhotoChooserTask (I was not able to get them in the View Model because I don't receive the notification after I choose/capture a photo but if anyone of you can do it please enlighten me how it's done )

I cannot test CameraCaptureTask and PhotoChooserTask but maybe some of you, lucky enough to have a test device, can test it and let me know how/if it works (even in the beta dev tools the camera is poorly integrated with the apps - you will have to run again the app after selecting camera or photo and you should be able to see the selected photo in the central image of my app this way you can press the Decode button).

This is how the test project looks (don't forget to flick the image)


Here is the source code

Have a look also at this new post

NAMASTE

0 comments:

Post a Comment