void ResumeInterruptedSession (NSObject sender)
{
// The session might fail to start running, e.g. if a phone or FaceTime call is still using audio or video.
// A failure to start the session will be communicated via a session runtime error notification.
// To avoid repeatedly failing to start the session running, we only try to restart the session in the
// session runtime error handler if we aren't trying to resume the session running.
sessionQueue.DispatchAsync (() => {
Session.StartRunning ();
sessionRunning = Session.Running;
if (!Session.Running) {
DispatchQueue.MainQueue.DispatchAsync (() => {
var message = "Unable to resume";
UIAlertController alertController = UIAlertController.Create ("AVCamManual", message, UIAlertControllerStyle.Alert);
UIAlertAction cancelAction = UIAlertAction.Create ("OK", UIAlertActionStyle.Cancel, null);
alertController.AddAction (cancelAction);
PresentViewController (alertController, true, null);
});
} else {
DispatchQueue.MainQueue.DispatchAsync (() => ResumeButton.Hidden = true);
}
});
}