private bool stopCamera() { if (_photoCamera == null) { return(false); } _timer.Stop(); _timer = null; _luminance = null; _reader = null; _photoCamera.Dispose(); _photoCamera = null; return(true); }
private void OnPhotoCameraInitialized(object sender, CameraOperationCompletedEventArgs e) { Dispatcher.BeginInvoke(() => { _timer = new DispatcherTimer(); _timer.Interval = TimeSpan.FromMilliseconds(250); _timer.Tick += (o, arg) => ScanPreviewBuffer(); int width = Convert.ToInt32(_photoCamera.PreviewResolution.Width); int height = Convert.ToInt32(_photoCamera.PreviewResolution.Height); _luminance = new PhotoCameraLuminanceSource(width, height); _reader = new QRCodeReader(); }); Dispatcher.BeginInvoke(() => { _previewTransform.Rotation = _photoCamera.Orientation; _timer.Start(); }); }
private void OnPhotoCameraInitialized(object sender, CameraOperationCompletedEventArgs e) { Dispatcher.BeginInvoke(() => { _timer = new DispatcherTimer(); _timer.Interval = TimeSpan.FromMilliseconds(250); _timer.Tick += (o, arg) => ScanPreviewBuffer(); 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); }); Dispatcher.BeginInvoke(() => { _previewTransform.Rotation = _photoCamera.Orientation; _timer.Start(); }); }
private bool stopCamera() { if (_photoCamera == null) { return false; } _timer.Stop(); _timer = null; _luminance = null; _reader = null; _photoCamera.Dispose(); _photoCamera = null; return true; }