void IBarCodeCamera.ToggleFlashlight()
        {
            Android.Hardware.Camera            Camera;
            Android.Hardware.Camera.Parameters parameters;

            try
            {
                Camera     = BarCodeCameraPreview.GetCamera();
                parameters = Camera.GetParameters();

                //prams.focus.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);

                if (!IsTorch)
                {
                    parameters.FlashMode = Android.Hardware.Camera.Parameters.FlashModeTorch;
                }
                else
                {
                    parameters.FlashMode = Android.Hardware.Camera.Parameters.FlashModeOff;
                }

                IsTorch = !IsTorch;
                Camera.SetParameters(parameters);
            }
            catch (Exception ex)
            {
                Console.WriteLine("BarCodeCamera Exception : {0}", ex.ToString());
            }
        }
        void ISurfaceHolderCallback.SurfaceCreated(ISurfaceHolder holder)
        {
            try
            {
                this.cameraSource.Start(this.surfaceView.Holder);

                BarCodeCameraPreview.GetCamera().SetDisplayOrientation(this.cameraPreview.Orientation);
            }
            catch (Exception ex)
            {
                Console.WriteLine("BarcodeSurfaceHolderCallback Exception : {0}", ex.ToString());
            }
        }
        object IBarCodeCamera.CreateViewGroup(object e)
        {
            if (barCodeCameraPreview == null || barCodeCameraPreview.IsDisposed || !barCodeCameraPreview.Context.Equals(this.context))
            {
                barCodeCameraPreview = new BarCodeCameraPreview(this.context);

                this.barCodeCameraView = (e as ElementChangedEventArgs <BarCodeCameraView>).NewElement;

                barCodeCameraPreview.OnDetected += (list) =>
                {
                    this.barCodeCameraView?.TriggerOnDetected(list);
                };

                this.barCodeCameraView.SizeChanged += CameraView_SizeChanged;

                return(barCodeCameraPreview);
            }

            return(null);
        }
 public BarcodeSurfaceHolderCallback(CameraSource cameraSource, SurfaceView surfaceView, BarCodeCameraPreview cameraPreview)
 {
     this.cameraSource  = cameraSource;
     this.surfaceView   = surfaceView;
     this.cameraPreview = cameraPreview;
 }