AVCamManual.AVCamManualCameraViewController.SetFocusAndMode C# (CSharp) Method

SetFocusAndMode() private method

private SetFocusAndMode ( AVCaptureFocusMode focusMode, AVCaptureExposureMode exposureMode, CGPoint point, bool monitorSubjectAreaChange ) : void
focusMode AVCaptureFocusMode
exposureMode AVCaptureExposureMode
point CGPoint
monitorSubjectAreaChange bool
return void
		void SetFocusAndMode (AVCaptureFocusMode focusMode, AVCaptureExposureMode exposureMode, CGPoint point, bool monitorSubjectAreaChange)
		{
			sessionQueue.DispatchAsync (() => {
				AVCaptureDevice device = VideoDevice;
				NSError error = null;
				if (device.LockForConfiguration (out error)) {
					// Setting (Focus|Exposure)PointOfInterest alone does not initiate a (focus/exposure) operation
					// Set (Focus|Exposure)Mode to apply the new point of interest
					if (focusMode != AVCaptureFocusMode.Locked && device.FocusPointOfInterestSupported && device.IsFocusModeSupported (focusMode)) {
						device.FocusMode = focusMode;
						device.FocusPointOfInterest = point;
					}
					if (exposureMode != AVCaptureExposureMode.Custom && device.ExposurePointOfInterestSupported && device.IsExposureModeSupported (exposureMode)) {
						device.ExposureMode = exposureMode;
						device.ExposurePointOfInterest = point;
					}
					device.SubjectAreaChangeMonitoringEnabled = monitorSubjectAreaChange;
					device.UnlockForConfiguration ();
				} else {
					Console.WriteLine ($"Could not lock device for configuration: {error}");
				}
			});
		}