zxing.net for winrt tablet in windows 8.1 issue with null results

Oct 20, 2014 at 7:52 PM
I'm trying to write a metro app for my tablet to take a picture of the barcode and decode it but I never get more than a null result coming back out of the decode?
              if (cbBarcode.IsChecked == true)
                {
                    var photoStorageFile = await KnownFolders.PicturesLibrary.CreateFileAsync("scan.jpg", CreationCollisionOption.GenerateUniqueName);
                    Uri uri1;
                    Uri.TryCreate("http:dotnetperls-com", UriKind.Absolute, out uri1);
                    Size aspectRatio = new Size(3, 1);
                    dialog.PhotoSettings.CroppedAspectRatio = aspectRatio;
                    StorageFile file = await dialog.CaptureFileAsync(CameraCaptureUIMode.Photo);
                    string ImageValues = "bbc_photo" + x;
                    var stream = await file.OpenReadAsync();
                    // initialize with 1,1 to get the current size of the image
                    var writeableBmp = new WriteableBitmap(1, 1);
                    writeableBmp.SetSource(stream);
                    // and create it again because otherwise the WB isn't fully initialized and decoding
                    // results in a IndexOutOfRange
                    writeableBmp = new WriteableBitmap(writeableBmp.PixelWidth, writeableBmp.PixelHeight);
                    stream.Seek(0);
                    writeableBmp.SetSource(stream);
                    var result = ScanBitMap(writeableBmp);
                    if (result != null)
                    {
                        MessageDialog dialog2 = new MessageDialog(result.Text.ToString());
                        await dialog2.ShowAsync();
                        //photoStorageFile = writeableBmp;
                    }
                    else
                    {
                        MessageDialog errdialog = new MessageDialog("Error reading barcode.. Please try again");
                        await errdialog.ShowAsync();
                    }
                    return;
                    


         private Result ScanBitMap(WriteableBitmap writeableBmp)
         {
             var barcodeReader = new BarcodeReader
             {
                 AutoRotate = true,
                 Options = new DecodingOptions
                 {
                     TryHarder = true,
                     // restrict to one or more supported types, if necessary
                     PossibleFormats = new []
                      {
                        BarcodeFormat.CODE_39
                       }
                 }
             };
             var result = barcodeReader.Decode(writeableBmp);

             if (result != null)
             {
                 CapturedPhoto.Source = writeableBmp;
             }

             return result;
         }
Coordinator
Nov 25, 2014 at 7:00 PM
I need the sample image which you try to decode.