public override void OnDisconnected(CameraDevice camera) { _cameraOpenCloseLock.Release(); camera.Close(); _cameraDeviceStateEventArgs.Camera = null; OnDisconnedted(this, _cameraDeviceStateEventArgs); }
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 }
/// <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); }