AVCamManual.AVCamManualCameraViewController.OnChangeExposureDurationClicked C# (CSharp) Метод

OnChangeExposureDurationClicked() приватный Метод

private OnChangeExposureDurationClicked ( NSObject sender ) : void
sender NSObject
Результат void
		void OnChangeExposureDurationClicked (NSObject sender)
		{
			var control = (UISlider)sender;
			NSError error = null;

			double p = Math.Pow (control.Value, ExposureDurationPower); // Apply power function to expand slider's low-end range
			double minDurationSeconds = Math.Max (VideoDevice.ActiveFormat.MinExposureDuration.Seconds, ExposureMinDuration);
			double maxDurationSeconds = VideoDevice.ActiveFormat.MaxExposureDuration.Seconds;
			double newDurationSeconds = p * (maxDurationSeconds - minDurationSeconds) + minDurationSeconds; // Scale from 0-1 slider range to actual duration

			if (VideoDevice.LockForConfiguration (out error)) {
				VideoDevice.LockExposure (CMTime.FromSeconds (newDurationSeconds, 1000 * 1000 * 1000), AVCaptureDevice.ISOCurrent, null);
				VideoDevice.UnlockForConfiguration ();
			} else {
				Console.WriteLine ($"Could not lock device for configuration: {error}");
			}
		}