Has anyone successfully used the static Camera class (Example around
somewhere) from a StringElement within a RootElement in Monotouch.Dialog?

Camera class shown below:-



        public static class Camera
        {
                static UIImagePickerController picker;
                static Action<NSDictionary> _callback;
                static void Init ()
                {
                        if (picker != null)
                        return;

                        picker = new UIImagePickerController ();
                        picker.Delegate = new CameraDelegate ();
                }
                class CameraDelegate : UIImagePickerControllerDelegate 
                {
                        public override void FinishedPickingMedia 
(UIImagePickerController
picker, NSDictionary info)
                        {
                                var cb = _callback;
                                _callback = null;

                                picker.DismissModalViewControllerAnimated 
(true);
                                cb (info);
                        }
                        public override void FinishedPickingImage 
(UIImagePickerController
picker,UIImage image, NSDictionary info)
                        {
                                var cb = _callback;
                                _callback = null;

                                picker.DismissModalViewControllerAnimated 
(true);
                                cb (info);
                        }
                }
                public static void TakePicture (UIViewController parent,
Action<NSDictionary> callback)
                {
                        Init ();
                        picker.SourceType = 
UIImagePickerControllerSourceType.Camera;
                        _callback = callback;
                        parent.PresentModalViewController (picker, true);
                }
}

No matter how I try, I just have been unsuccessful at getting this to work.

If anyone have a snippet that might help me through this conundrum, I would
be very grateful indeed.

Thanks

--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/Using-Camera-TakePicture-in-Monotouch-Dialog-tp4655736.html
Sent from the MonoTouch mailing list archive at Nabble.com.
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to