public void OnChangeExposureModeClicked (NSObject sender)
{
var control = (UISegmentedControl)sender;
AVCaptureExposureMode mode = exposureModes [control.SelectedSegment];
NSError error = null;
bool success = VideoDevice.LockForConfiguration (out error);
if (!success) {
Console.WriteLine ($"Could not lock device for configuration: {error}");
return;
}
if (VideoDevice.IsExposureModeSupported (mode)) {
VideoDevice.ExposureMode = mode;
} else {
Console.WriteLine ($"Exposure mode {StringFromExposureMode (mode)} is not supported. Exposure mode is {StringFromExposureMode (VideoDevice.ExposureMode)}.");
ExposureModeControl.SelectedSegment = Array.IndexOf (exposureModes, VideoDevice.ExposureMode);
}
VideoDevice.UnlockForConfiguration ();
}