Unity.Platform.IPhone.IPhoneMedia.ShowImagePickerView C# (CSharp) Method

ShowImagePickerView() private method

private ShowImagePickerView ( ) : void
return void
		private void ShowImagePickerView ()
		{
			UIApplication.SharedApplication.InvokeOnMainThread (delegate {
				UIImagePickerController imagePickerController = new UIImagePickerController();
				imagePickerController.FinishedPickingImage += HandleImagePickerControllerFinishedPickingImage;
				imagePickerController.FinishedPickingMedia += HandleImagePickerControllerFinishedPickingMedia;
				imagePickerController.Canceled += HandleImagePickerControllerCanceled;
				
				
				if(IPhoneUtils.GetInstance().IsIPad()) {
					try {
						
						// in iPad, the UIImagePickerController should be presented inside a UIPopoverController, otherwise and exception is raised
						popover = new UIPopoverController(imagePickerController);
						UIView view = IPhoneServiceLocator.CurrentDelegate.MainUIViewController ().View;
						//CGRect frame = new CGRect(new PointF(0,0),new SizeF(view.Frame.Size.Width, view.Frame.Size.Height));
						CGRect frame = new CGRect(new PointF(0,0),new SizeF(0,0));
						popover.PresentFromRect(frame, view, UIPopoverArrowDirection.Up, true); 
					
					}catch(Exception ex) {
						INotification notificationService = (INotification)IPhoneServiceLocator.GetInstance ().GetService ("notify");
						if (notificationService != null) {
							notificationService.StartNotifyAlert ("Media Alert", "Unable to reach Photo Library", "OK");
						}	
						if(popover != null && popover.PopoverVisible) {
							popover.Dismiss(true);
		        			popover.Dispose();
						}
					}
					
				} else {
					IPhoneServiceLocator.CurrentDelegate.MainUIViewController ().PresentModalViewController (imagePickerController, true);
				}
			});
		}