void Camera_Initialized(object sender, Microsoft.Devices.CameraOperationCompletedEventArgs e)
{
if (e.Succeeded)
{
this.Dispatcher.BeginInvoke(delegate()
{
_phoneCamera.FlashMode = FlashMode.Off;
_previewBuffer = new WriteableBitmap((int)_phoneCamera.PreviewResolution.Width,
(int)_phoneCamera.PreviewResolution.Height);
_barcodeReader = new BarcodeReader();
_barcodeReader.TryHarder = true;
_barcodeReader.ResultFound += BarcodeReader_ResultFound;
_scanTimer.Start();
OpticalReaderTask.TaskPending = true;
});
}
else
{
Dispatcher.BeginInvoke(() =>
{
MessageBox.Show("Unable to initialize the camera");
});
}
}