void AddObservers ()
{
// To learn more about KVO visit:
// http://tirania.org/monomac/archive/2012/Apr-19.html?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+MiguelsOsxAndIosBlog+(Miguel%27s+OSX+and+iOS+blog)
runningToken = AddObserver ("session.running", NSKeyValueObservingOptions.New, SessionRunningChanged);
focusModeToken = AddObserver ("videoDevice.focusMode", NSKeyValueObservingOptions.Old | NSKeyValueObservingOptions.New, FocusModeChanged);
lensPositionToken = AddObserver ("videoDevice.lensPosition", NSKeyValueObservingOptions.New, LensPositionChanged);
exposureModeToken = AddObserver ("videoDevice.exposureMode", NSKeyValueObservingOptions.Old | NSKeyValueObservingOptions.New, ExposureModeChanged);
exposureDurationToken = AddObserver ("videoDevice.exposureDuration", NSKeyValueObservingOptions.New, ExposureDurationChanged);
isoToken = AddObserver ("videoDevice.ISO", NSKeyValueObservingOptions.New, ISOChanged);
exposureTargetBiasToken = AddObserver ("videoDevice.exposureTargetBias", NSKeyValueObservingOptions.New, ExposureTargetBiasChanged);
exposureTargetOffsetToken = AddObserver ("videoDevice.exposureTargetOffset", NSKeyValueObservingOptions.New, ExposureTargetOffsetChanged);
whiteBalanceModeToken = AddObserver ("videoDevice.whiteBalanceMode", NSKeyValueObservingOptions.Old | NSKeyValueObservingOptions.New, WhiteBalanceModeChange);
deviceWhiteBalanceGainsToken = AddObserver ("videoDevice.deviceWhiteBalanceGains", NSKeyValueObservingOptions.New, DeviceWhiteBalanceGainsChange);
subjectAreaDidChangeToken = NSNotificationCenter.DefaultCenter.AddObserver (AVCaptureDevice.SubjectAreaDidChangeNotification, SubjectAreaDidChange, VideoDevice);
runtimeErrorToken = NSNotificationCenter.DefaultCenter.AddObserver (AVCaptureSession.RuntimeErrorNotification, SessionRuntimeError, Session);
// A session can only run when the app is full screen. It will be interrupted in a multi-app layout, introduced in iOS 9,
// see also the documentation of AVCaptureSessionInterruptionReason. Add observers to handle these session interruptions
// and show a preview is paused message. See the documentation of AVCaptureSessionWasInterruptedNotification for other
// interruption reasons.
wasInterruptedToken = NSNotificationCenter.DefaultCenter.AddObserver (AVCaptureSession.WasInterruptedNotification, SessionWasInterrupted, Session);
interruptionEndedToken = NSNotificationCenter.DefaultCenter.AddObserver (AVCaptureSession.InterruptionEndedNotification, SessionInterruptionEnded, Session);
}