// Update the UI if initialization succeeds. void PhotoCameraOnInitialized(object sender, Microsoft.Devices.CameraOperationCompletedEventArgs e) { if (e.Succeeded) { // Disable the flash to avoid reflections _photoCamera.FlashMode = FlashMode.Off; int width = Convert.ToInt32(_photoCamera.PreviewResolution.Width); int height = Convert.ToInt32(_photoCamera.PreviewResolution.Height); _luminance = new PhotoCameraLuminanceSource(width, height); _reader = new BarcodeReader(null, bmp => _luminance, null); _reader.ResultFound += ReaderOnResultFound; Dispatcher.BeginInvoke(() => _photoCamera.Focus()); } }