Example #1
0
        public void StopScanning()
        {
            if (UseCustomOverlay && CustomOverlay != null)
            {
                gridCustomOverlay.Children.Remove(CustomOverlay);
            }

            BlackoutVideoBrush();

            if (_reader != null)
            {
                _reader.Stop();
                _reader = null;
            }
        }
Example #2
0
        public void StartScanning(Action <ZXing.Result> scanCallback, MobileBarcodeScanningOptions options = null)
        {
            ScanCallback    = scanCallback;
            ScanningOptions = options ?? MobileBarcodeScanningOptions.Default;

            this.topText.Text    = TopText;
            this.bottomText.Text = BottomText;

            if (UseCustomOverlay)
            {
                gridCustomOverlay.Children.Clear();
                if (CustomOverlay != null)
                {
                    gridCustomOverlay.Children.Add(CustomOverlay);
                }

                gridCustomOverlay.Visibility  = Visibility.Visible;
                gridDefaultOverlay.Visibility = Visibility.Collapsed;
            }
            else
            {
                gridCustomOverlay.Visibility  = Visibility.Collapsed;
                gridDefaultOverlay.Visibility = Visibility.Visible;
            }

            MobileBarcodeScanner.Log("ZXingScannerControl.StartScanning");

            // Initialize a new instance of SimpleCameraReader with Auto-Focus mode on
            if (_reader == null)
            {
                MobileBarcodeScanner.Log("Creating SimpleCameraReader");

                //_reader = new SimpleCameraReader(options);
                _reader = new AudioVideoCaptureDeviceCameraReader(options);
                _reader.ScanInterval = ScanningOptions.DelayBetweenAnalyzingFrames;

                // AudioVideoCaptureDevice - move this to camera initialized otherwise throws
                // We need to set the VideoBrush we're going to display the preview feed on
                // IMPORTANT that it gets set before Camera initializes
                //_previewVideo.SetSource(_reader.Camera);

                // The reader throws an event when a result is available
                _reader.DecodingCompleted += (o, r) => DisplayResult(r);

                // The reader throws an event when the camera is initialized and ready to use
                _reader.CameraInitialized += ReaderOnCameraInitialized;
            }
        }
        public void StartScanning(Action<ZXing.Result> scanCallback, MobileBarcodeScanningOptions options = null)
        {
            ScanCallback = scanCallback;
            ScanningOptions = options ?? MobileBarcodeScanningOptions.Default;

            this.topText.Text = TopText;
            this.bottomText.Text = BottomText;

            if (UseCustomOverlay)
            {
                gridCustomOverlay.Children.Clear();
                if (CustomOverlay != null)
                    gridCustomOverlay.Children.Add(CustomOverlay);

                gridCustomOverlay.Visibility = Visibility.Visible;
                gridDefaultOverlay.Visibility = Visibility.Collapsed;
            }
            else
            {
                gridCustomOverlay.Visibility = Visibility.Collapsed;
                gridDefaultOverlay.Visibility = Visibility.Visible;
            }

            MobileBarcodeScanner.Log("ZXingScannerControl.StartScanning");

            // Initialize a new instance of SimpleCameraReader with Auto-Focus mode on
            if (_reader == null)
            {
                MobileBarcodeScanner.Log("Creating SimpleCameraReader");

                //_reader = new SimpleCameraReader(options);
                _reader = new AudioVideoCaptureDeviceCameraReader(options);
                _reader.ScanInterval = ScanningOptions.DelayBetweenAnalyzingFrames;

                // AudioVideoCaptureDevice - move this to camera initialized otherwise throws
                // We need to set the VideoBrush we're going to display the preview feed on
                // IMPORTANT that it gets set before Camera initializes
                //_previewVideo.SetSource(_reader.Camera);

                // The reader throws an event when a result is available 
                _reader.DecodingCompleted += (o, r) => DisplayResult(r);

                // The reader throws an event when the camera is initialized and ready to use
                _reader.CameraInitialized += ReaderOnCameraInitialized;
            }
        }
        public void StopScanning()
        {
            if (UseCustomOverlay && CustomOverlay != null)
            {
                gridCustomOverlay.Children.Remove(CustomOverlay);
            }

            BlackoutVideoBrush();

            if (_reader != null)
            {
                _reader.Stop();
                _reader.CameraInitialized -= ReaderOnCameraInitialized;
                _reader.DecodingCompleted -= (o, r) => DisplayResult(r);
                _reader = null;
            }
        }
        public void StopScanning()
        {
            if (UseCustomOverlay && CustomOverlay != null)
                gridCustomOverlay.Children.Remove(CustomOverlay);

            BlackoutVideoBrush();

            if (_reader != null)
            {
                _reader.Stop();
                _reader.CameraInitialized -= ReaderOnCameraInitialized;
		_reader.DecodingCompleted -= (o, r) => DisplayResult(r);
                _reader = null;
            }
        }
        public void StopScanning()
        {
            if (UseCustomOverlay && CustomOverlay != null)
                gridCustomOverlay.Children.Remove(CustomOverlay);

            BlackoutVideoBrush();

            if (_reader != null)
            {
                _reader.Stop();
                _reader = null;
            }
        }