public override void CaptureImage(object imageDest, object context, CaptureImageEvent callback) { // first ensure they passed in the correct context type UIViewController controller = context as UIViewController; if (context == null) { throw new Exception("Context must be a UIViewController"); } string imageDestStr = imageDest as string; if (imageDestStr == null) { throw new Exception("imageDest must be of type string."); } ImageDest = imageDestStr; // store our callback event CaptureImageEventDelegate = callback; // create our camera controller CameraController.Instance.SourceType = UIImagePickerControllerSourceType.Camera; // when media is chosen CameraController.Instance.FinishedPickingMedia -= CameraImageCaptured; CameraController.Instance.FinishedPickingMedia += CameraImageCaptured; // when picking is cancelled. CameraController.Instance.Canceled -= CameraImageCanceled; CameraController.Instance.Canceled += CameraImageCanceled; controller.PresentViewController(CameraController.Instance, true, null); }
public override void CaptureImage(object imageDest, object context, CaptureImageEvent callback) { // ensure the context passed in is valid. Activity activity = Rock.Mobile.PlatformSpecific.Android.Core.Context as Activity; if (activity == null) { throw new Exception("Rock.Mobile.PlatformSpecific.Android.Core.Context must be of type Activity."); } // store the location they want the file to be in. Java.IO.File imageFileDest = imageDest as Java.IO.File; if (imageFileDest == null) { throw new Exception("imageDest must be of type File"); } CaptureImageEventDelegate = callback; // kick off the activity that will manage the camera Intent intent = new Intent(activity, typeof(CameraActivity)); intent.PutExtra("ImageDest", imageFileDest); activity.StartActivity(intent); }
public abstract void CaptureImage(object imageDest, object context, CaptureImageEvent callback);