private async void OnError(Exception e)
 {
     Cleanup();
     await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(
         CoreDispatcherPriority.Normal, () =>
     {
         BarCodeManager.OnError(e);
         this.Frame.GoBack();
     });
 }
 private void ScanImage(byte[] pixelsArray)
 {
     try
     {
         var result = BarCodeManager.ScanBitmap(pixelsArray, (int)_width, (int)_height);
         if (result != null)
         {
             OnBarCodeFound(result.Text);
         }
     }
     catch (Exception e)
     {
         Debug.WriteLine(e);
         // Wasn't able to find a barcode
     }
     finally
     {
         _semScan.Release();
     }
 }