Example #1
0
        private void OnPhotoCameraInitialized(object sender, CameraOperationCompletedEventArgs e)
        {
            var width  = Convert.ToInt32(_photoCamera.PreviewResolution.Width);
            var height = Convert.ToInt32(_photoCamera.PreviewResolution.Height);

            Dispatcher.BeginInvoke(() =>
            {
                _previewTransform.Rotation = _photoCamera.Orientation;
                // create a luminance source which gets its values directly from the camera
                // the instance is returned directly to the reader
                _luminance = new PhotoCameraLuminanceSource(width, height);
                _reader    = new BarcodeReader(null, bmp => _luminance, null);
            });
        }
Example #2
0
        private bool stopCamera()
        {
            if (_photoCamera == null)
            {
                return(false);
            }

            _luminance = null;
            _reader    = null;

            _photoCamera.Initialized -= OnPhotoCameraInitialized;
            _photoCamera.Dispose();

            CameraButtons.ShutterKeyHalfPressed -= OnButtonHalfPress;

            _photoCamera = null;

            return(true);
        }
        private bool stopCamera()
        {
            if (_photoCamera == null)
            {
                return false;
            }

            _luminance = null;
            _reader = null;

            _photoCamera.Initialized -= OnPhotoCameraInitialized;
            _photoCamera.Dispose();

            CameraButtons.ShutterKeyHalfPressed -= OnButtonHalfPress;

            _photoCamera = null;

            return true;
        }
        private void OnPhotoCameraInitialized(object sender, CameraOperationCompletedEventArgs e)
        {
            var width = Convert.ToInt32(_photoCamera.PreviewResolution.Width);
            var height = Convert.ToInt32(_photoCamera.PreviewResolution.Height);

            Dispatcher.BeginInvoke(() =>
            {
                _previewTransform.Rotation = _photoCamera.Orientation;
                // create a luminance source which gets its values directly from the camera
                // the instance is returned directly to the reader
                _luminance = new PhotoCameraLuminanceSource(width, height);
                _reader = new BarcodeReader(null, bmp => _luminance, null);
            });
        }