public void OnChangeWhiteBalanceModeClicked (NSObject sender)
{
var control = (UISegmentedControl)sender;
AVCaptureWhiteBalanceMode mode = whiteBalanceModes [control.SelectedSegment];
NSError error = null;
var success = VideoDevice.LockForConfiguration (out error);
if (!success) {
Console.WriteLine ($"Could not lock device for configuration: {error}");
return;
}
if (VideoDevice.IsWhiteBalanceModeSupported (mode)) {
VideoDevice.WhiteBalanceMode = mode;
} else {
Console.WriteLine ($"White balance mode {StringFromWhiteBalanceMode (mode)} is not supported. White balance mode is {StringFromWhiteBalanceMode (VideoDevice.WhiteBalanceMode)}.");
WhiteBalanceModeControl.SelectedSegment = Array.IndexOf (whiteBalanceModes, VideoDevice.WhiteBalanceMode);
}
VideoDevice.UnlockForConfiguration ();
}