void AddObservers ()
{
runningChangeToken = session.AddObserver ("running", NSKeyValueObservingOptions.New, RunningChanged);
// Observe the previewView's regionOfInterest to update the AVCaptureMetadataOutput's
// RectOfInterest when the user finishes resizing the region of interest.
PreviewView.RegionOfInterestDidChange += RegionOfInterestChanged;
var center = NSNotificationCenter.DefaultCenter;
runtimeErrorNotificationToken = center.AddObserver (AVCaptureSession.RuntimeErrorNotification, OnRuntimeErrorNotification, 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.
wasInterruptedNotificationToken = center.AddObserver (AVCaptureSession.WasInterruptedNotification, OnSessionWasInterrupted, session);
interruptionEndedNotificationToken = center.AddObserver (AVCaptureSession.InterruptionEndedNotification, OnSessionInterruptionEnded, session);
}