void ResumeInterruptedSession (CameraViewController sender)
{
sessionQueue.DispatchAsync (() => {
// 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 running 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 running in the
// session runtime error handler if we aren't trying to resume the session running.
session.StartRunning ();
sessionRunning = session.Running;
if (!session.Running) {
DispatchQueue.MainQueue.DispatchAsync (() => {
const string message = "Unable to resume";
UIAlertController alertController = UIAlertController.Create ("AVCam", 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;
});
}
});
}