Пример #1
0
        public override void OnDisconnected(CameraDevice camera)
        {
            _cameraOpenCloseLock.Release();

            camera.Close();

            _cameraDeviceStateEventArgs.Camera = null;
            OnDisconnedted(this, _cameraDeviceStateEventArgs);
        }
Пример #2
0
        public override void OnError(CameraDevice camera, CameraError error)
        {
            _cameraOpenCloseLock.Release();

            camera.Close();

            _cameraDeviceStateEventArgs.Camera = null;
            _cameraDeviceStateEventArgs.Error  = error;
            OnError(this, _cameraDeviceStateEventArgs);

            // Undone: Stop Activity/Service
        }
Пример #3
0
        /// <summary>
        /// Closes the camera.
        /// </summary>
        /// <returns>Completed Task.</returns>
        protected virtual Task CloseCamera()
        {
            if (CameraCaptureSession != null)
            {
                CameraCaptureSession.Close();
                CameraCaptureSession = null;
            }

            if (CameraDevice != null)
            {
                CameraDevice.Close();
                CameraDevice = null;
            }

            return(Task.CompletedTask);
        }