コード例 #1
0
        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());
            }
        }