void RunningChanged (NSObservedChange obj)
{
var isSessionRunning = ((NSNumber)obj.NewValue).BoolValue;
DispatchQueue.MainQueue.DispatchAsync (() => {
MetadataObjectTypesButton.Enabled = isSessionRunning;
SessionPresetsButton.Enabled = isSessionRunning;
CameraButton.Enabled = isSessionRunning && AVCaptureDevice.DevicesWithMediaType (AVMediaType.Video).Length > 1;
ZoomSlider.Enabled = isSessionRunning;
ZoomSlider.MaxValue = (float)NMath.Min (videoDeviceInput.Device.ActiveFormat.VideoMaxZoomFactor, 8);
ZoomSlider.Value = (float)(videoDeviceInput.Device.VideoZoomFactor);
// After the session stop running, remove the metadata object overlays,
// if any, so that if the view appears again, the previously displayed
// metadata object overlays are removed.
if (!isSessionRunning)
RemoveMetadataObjectOverlayLayers ();
});
}