public override void ViewDidLoad() { base.ViewDidLoad(); // By default we want the picker hidden until the textbox is tapped. this.pkNumberPicker.Alpha = 0; // Wire up our eventhandler to "valuechanged" member ehValueChanged = new Action <object, EventArgs>(valuechanged); this._pickerdelegate = new PickerDelegate(this.items); this._pickersource = new PickerSource(this.items); this._txtNumberDelegate = new txtNumberDelegate(); this.pkNumberPicker.Delegate = this._pickerdelegate; this.pkNumberPicker.DataSource = this._pickersource; this.txtNumber.Delegate = this._txtNumberDelegate; // Wire up the value change method this._pickerdelegate.psValueChanged += this.ehValueChanged; // pickerDataModel = new PickerDataModel(); // this.pkNumberPicker.Source = pickerDataModel; // this.pkNumberPicker.Center = this.txtNumber.Center ; // this.pkNumberPicker.ValueChanged += (s, e) => // { // this.txtNumber.Text = this._pickerdelegate.SelectedItem; // }; // // // set our initial selection on the label // this.txtNumber.Text = pickerDataModel.SelectedItem; }
public override void ViewDidLoad() { base.ViewDidLoad(); _picker = new UIImagePickerController(); _pickerDel = new PickerDelegate(this); _picker.Delegate = _pickerDel; _actionSheet = new UIActionSheet(); _actionSheet.AddButton("Library"); _actionSheet.AddButton("Camera"); _actionSheet.AddButton("Cancel"); _actionSheet.CancelButtonIndex = 2; _actionSheet.Delegate = new ActionSheetDelegate(this); showPicker.TouchUpInside += delegate { _actionSheet.ShowInView(this.View); }; playMovie.Hidden = true; playMovie.TouchUpInside += delegate { if (_mp != null) { View.AddSubview(_mp.View); _mp.SetFullscreen(true, true); _mp.Play(); } }; }
public override void ViewDidLoad () { base.ViewDidLoad (); _picker = new UIImagePickerController (); _pickerDel = new PickerDelegate (this); _picker.Delegate = _pickerDel; _actionSheet = new UIActionSheet (); _actionSheet.AddButton ("Library"); _actionSheet.AddButton ("Camera"); _actionSheet.AddButton ("Cancel"); _actionSheet.CancelButtonIndex = 2; _actionSheet.Delegate = new ActionSheetDelegate (this); showPicker.TouchUpInside += delegate { _actionSheet.ShowInView (this.View); }; playMovie.Hidden = true; playMovie.TouchUpInside += delegate { if (_mp != null) { View.AddSubview (_mp.View); _mp.SetFullscreen (true, true); _mp.Play (); } }; }
static UIImagePickerController CreateController(PickerDelegate mpDelegate, UIImagePickerControllerSourceType sourceType, string mediaType, MediaCaptureSettings settings) { var picker = new UIImagePickerController { Delegate = mpDelegate, MediaTypes = new[] { mediaType }, SourceType = sourceType }; if (sourceType != UIImagePickerControllerSourceType.Camera) { return(picker); } if (settings.Camera == CameraOption.Front) { picker.CameraDevice = UIImagePickerControllerCameraDevice.Front; } picker.AllowsEditing = settings.AllowEditing; if (settings.OverlayViewProvider != null) { var overlay = settings.OverlayViewProvider(); if (overlay is UIView) { picker.CameraOverlayView = overlay as UIView; } } if (mediaType == VIDEO_TYPE) { if (settings.VideoMaxDuration.HasValue) { picker.VideoMaximumDuration = settings.VideoMaxDuration.Value.TotalSeconds; } picker.CameraCaptureMode = UIImagePickerControllerCameraCaptureMode.Video; switch (settings.VideoQuality) { case VideoQuality.Medium: picker.VideoQuality = UIImagePickerControllerQualityType.Medium; break; case VideoQuality.Low: picker.VideoQuality = UIImagePickerControllerQualityType.Low; break; default: picker.VideoQuality = UIImagePickerControllerQualityType.High; break; } } return(picker); }
public override void ViewDidLoad () { base.ViewDidLoad (); this.Title = "Custom Camera View"; this.btnTakePhoto.TouchUpInside += (object sender, EventArgs e) => { try { // create a new picker controller imagePicker = new UIImagePickerController (); // set our source to the camera imagePicker.SourceType = UIImagePickerControllerSourceType.Camera; // set imagePicker.MediaTypes = new string[] { "public.image" }; // show the camera controls imagePicker.ShowsCameraControls = true; //UILabel overlay = new UILabel (new System.Drawing.RectangleF (20, 100, 200, 30)); //overlay.Text = "This is an overlay"; //imagePicker.CameraOverlayView = overlay; //BUGBUG: MT/Apple Bug? - this won't display the overlay, but if i add a label, it'll display //imagePicker.CameraOverlayView = new CameraOverlayView (UIScreen.MainScreen.ApplicationFrame); //Fix bug 14776 to make Retake and UsePhoto usable on iOS7 device. imagePicker.CameraOverlayView = new CameraOverlayView (); // attach the delegate pickerDelegate = new PickerDelegate (); imagePicker.Delegate = pickerDelegate; // show the picker this.NavigationController.PresentModalViewController (imagePicker, true); } catch { UIAlertView alert = new UIAlertView ("No Camera", "No Camera Detected!", null, "OK", null); alert.Show (); } }; }
public override void ViewDidLoad() { base.ViewDidLoad(); this.Title = "Custom Camera View"; this.btnTakePhoto.TouchUpInside += (object sender, EventArgs e) => { try { // create a new picker controller imagePicker = new UIImagePickerController(); // set our source to the camera imagePicker.SourceType = UIImagePickerControllerSourceType.Camera; // set imagePicker.MediaTypes = new string[] { "public.image" }; // show the camera controls imagePicker.ShowsCameraControls = true; //UILabel overlay = new UILabel (new System.Drawing.RectangleF (20, 100, 200, 30)); //overlay.Text = "This is an overlay"; //imagePicker.CameraOverlayView = overlay; //BUGBUG: MT/Apple Bug? - this won't display the overlay, but if i add a label, it'll display //imagePicker.CameraOverlayView = new CameraOverlayView (UIScreen.MainScreen.ApplicationFrame); //Fix bug 14776 to make Retake and UsePhoto usable on iOS7 device. imagePicker.CameraOverlayView = new CameraOverlayView(); // attach the delegate pickerDelegate = new PickerDelegate(); imagePicker.Delegate = pickerDelegate; // show the picker this.NavigationController.PresentModalViewController(imagePicker, true); } catch (Exception ex) { UIAlertView alert = new UIAlertView("No Camera", "No Camera Detected!", null, "OK", null); alert.Show(); } }; }
static async Task <FileInfo> DoLaunchMediaPicker(UIImagePickerControllerSourceType sourceType, string mediaType, MediaCaptureSettings settings) { Log.For(typeof(Media)).Warning("DoLaunchMediaPicker called"); var controller = UIRuntime.Window.RootViewController; while (controller.PresentedViewController != null) { controller = controller.PresentedViewController; } var pickerDelegate = new PickerDelegate(controller, sourceType); var picker = CreateController(pickerDelegate, sourceType, mediaType, settings); var usePopup = UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad && sourceType == UIImagePickerControllerSourceType.PhotoLibrary; if (usePopup) { pickerDelegate.Popover = new UIPopoverController(picker) { Delegate = new PickerPopoverDelegate(pickerDelegate, picker) }; pickerDelegate.DisplayPopover(); } else { if (OS.IsAtLeastiOS(9)) { picker.ModalPresentationStyle = UIModalPresentationStyle.OverCurrentContext; } controller.PresentViewController(picker, animated: true, completionHandler: null); } return(await pickerDelegate.CompletionSource.Task.ConfigureAwait(false)); }
public override void ViewDidLoad() { base.ViewDidLoad(); this.Title = "Custom Camera View"; this.btnTakePhoto.TouchUpInside += (object sender, EventArgs e) => { //---- create a new picker controller this._imagePicker = new UIImagePickerController(); //---- set our source to the camera this._imagePicker.SourceType = UIImagePickerControllerSourceType.Camera; //---- set this._imagePicker.MediaTypes = new string[] { "public.image" }; //---- show the camera controls this._imagePicker.ShowsCameraControls = true; //UILabel overlay = new UILabel (new System.Drawing.RectangleF (20, 100, 200, 30)); //overlay.Text = "This is an overlay"; //this._imagePicker.CameraOverlayView = overlay; //BUGBUG: MT/Apple Bug? - this won't display the overlay, but if i add a label, it'll display this._imagePicker.CameraOverlayView = new CameraOverlayView(this.view.Frame); //---- attach the delegate this._pickerDelegate = new PickerDelegate(); this._imagePicker.Delegate = this._pickerDelegate; //---- show the picker this.NavigationController.PresentModalViewController(this._imagePicker, true); }; }
public override void ViewDidLoad() { base.ViewDidLoad(); //Set the base editmode this.CurrentEditMode = E__NumberComboEditMode.EditNumPad; // Wire up our eventhandler to "valuechanged" member // PASS A FUNCTION INTO THIS! ehValueChanged = new Action(PickerValueChanged); this._pickerdelegate = new PickerDelegate(this.items); this._pickersource = new PickerSource(this.items); this._txtNumberDelegate = new txtNumberDelegate(); // Wire up the value change method this._pickerdelegate.psValueChanged += this.ehValueChanged; // Wire up tapgesture to //this.txtSingleTapGestureRecognizer(); // TOP CLASS FUNCTIONALITY // THIS NEEDS TO BE CALLED BY EACH TEXTFIELD // Set initital values //this.preEdit(); // TOPCLASS FUNCTIONALITY // By default we want the picker hidden until the textbox is tapped. //this.View.SendSubviewToBack(this.pkNumberPicker); //this.pkNumberPicker.Hidden = true; // TOP CLASS FUNCTIONALITY //this.pkNumberPicker.Delegate = this._pickerdelegate; //this.pkNumberPicker.DataSource = this._pickersource; //this.txtNumber.Delegate = this._txtNumberDelegate; }
public override void ViewDidLoad() { base.ViewDidLoad(); Title = "Image Picker"; // populate the features table PopulateFeaturesTable(); btnChoosePhoto.TouchUpInside += (s, e) => { // create a new picker controller imagePicker = new UIImagePickerController(); // set our source to the photo library imagePicker.SourceType = UIImagePickerControllerSourceType.PhotoLibrary; // set what media types imagePicker.MediaTypes = UIImagePickerController.AvailableMediaTypes(UIImagePickerControllerSourceType.PhotoLibrary); // As with most controls, you can either handle the events directly, or // wire up a delegate. in this first one, i wire up the events. in the other two, // i use a delegate imagePicker.FinishedPickingMedia += Handle_imagePickerhandleFinishedPickingMedia; imagePicker.Canceled += (sender, evt) => { Console.WriteLine("picker cancelled"); // HACK: NavigationController.DismissModalViewControllerAnimated to NavigationController.DismissModalViewController imagePicker.DismissModalViewController(true); }; // show the picker NavigationController.PresentModalViewController(imagePicker, true); }; btnTakePhoto.TouchUpInside += (s, e) => { try { // create a new picker controller imagePicker = new UIImagePickerController(); // set our source to the camera imagePicker.SourceType = UIImagePickerControllerSourceType.Camera; // set what media types imagePicker.MediaTypes = UIImagePickerController.AvailableMediaTypes(UIImagePickerControllerSourceType.Camera); // show the camera controls imagePicker.ShowsCameraControls = true; // attach the delegate pickerDelegate = new ImagePickerScreen.PickerDelegate(); imagePicker.Delegate = pickerDelegate; // show the picker NavigationController.PresentModalViewController(imagePicker, true); } catch { UIAlertView alert = new UIAlertView("No Camera", "No Camera Detected!", null, "OK", null); alert.Show(); } }; btnPhotoRoll.TouchUpInside += (s, e) => { // create a new picker controller imagePicker = new UIImagePickerController(); // set our source to the camera imagePicker.SourceType = UIImagePickerControllerSourceType.SavedPhotosAlbum; // set what media types imagePicker.MediaTypes = UIImagePickerController.AvailableMediaTypes(UIImagePickerControllerSourceType.SavedPhotosAlbum); // attach the delegate pickerDelegate = new ImagePickerScreen.PickerDelegate(); imagePicker.Delegate = pickerDelegate; // show the picker NavigationController.PresentModalViewController(imagePicker, true); }; }
//================================================================================ public override void ViewDidLoad() { base.ViewDidLoad(); this.Title = "Image Picker"; //---- populate the features table this.PopulateFeaturesTable(); this.btnChoosePhoto.TouchUpInside += (s, e) => { //---- create a new picker controller this._imagePicker = new UIImagePickerController(); //---- set our source to the photo library this._imagePicker.SourceType = UIImagePickerControllerSourceType.PhotoLibrary; //---- set this._imagePicker.MediaTypes = UIImagePickerController.AvailableMediaTypes(UIImagePickerControllerSourceType.PhotoLibrary); //---- attach the delegate this._pickerDelegate = new ImagePickerScreen.PickerDelegate(); this._imagePicker.Delegate = this._pickerDelegate; //---- show the picker this.NavigationController.PresentModalViewController(this._imagePicker, true); }; this.btnTakePhoto.TouchUpInside += (s, e) => { //---- create a new picker controller this._imagePicker = new UIImagePickerController(); //---- set our source to the camera this._imagePicker.SourceType = UIImagePickerControllerSourceType.Camera; //---- set this._imagePicker.MediaTypes = UIImagePickerController.AvailableMediaTypes(UIImagePickerControllerSourceType.Camera); //---- show the camera controls this._imagePicker.ShowsCameraControls = true; //---- attach the delegate this._pickerDelegate = new ImagePickerScreen.PickerDelegate(); this._imagePicker.Delegate = this._pickerDelegate; //---- show the picker this.NavigationController.PresentModalViewController(this._imagePicker, true); }; this.btnPhotoRoll.TouchUpInside += (s, e) => { //---- create a new picker controller this._imagePicker = new UIImagePickerController(); //---- set our source to the camera this._imagePicker.SourceType = UIImagePickerControllerSourceType.SavedPhotosAlbum; //---- set this._imagePicker.MediaTypes = UIImagePickerController.AvailableMediaTypes(UIImagePickerControllerSourceType.SavedPhotosAlbum); //---- attach the delegate this._pickerDelegate = new ImagePickerScreen.PickerDelegate(); this._imagePicker.Delegate = this._pickerDelegate; //---- show the picker this.NavigationController.PresentModalViewController(this._imagePicker, true); }; }
public CheckedPickerView(RectangleF frame) : base(frame) { Delegate = new PickerDelegate(); DataSource = new PickerDataSource(); }
internal PickerPopoverDelegate(PickerDelegate pickerDelegate, UIImagePickerController picker) { Delegate = pickerDelegate; Picker = picker; }
public CheckedPickerView (RectangleF frame) : base (frame) { Delegate = new PickerDelegate (); DataSource = new PickerDataSource (); }
public DemoViewController() { pickerDelegate = new PickerDelegate(); }
public override void ViewDidLoad() { base.ViewDidLoad (); Title = "Image Picker"; // populate the features table PopulateFeaturesTable (); btnChoosePhoto.TouchUpInside += (s, e) => { // create a new picker controller imagePicker = new UIImagePickerController (); // set our source to the photo library imagePicker.SourceType = UIImagePickerControllerSourceType.PhotoLibrary; // set what media types imagePicker.MediaTypes = UIImagePickerController.AvailableMediaTypes (UIImagePickerControllerSourceType.PhotoLibrary); // As with most controls, you can either handle the events directly, or // wire up a delegate. in this first one, i wire up the events. in the other two, // i use a delegate imagePicker.FinishedPickingMedia += Handle_imagePickerhandleFinishedPickingMedia; imagePicker.Canceled += (sender,evt) => { Console.WriteLine ("picker cancelled"); // HACK: NavigationController.DismissModalViewControllerAnimated to NavigationController.DismissModalViewController imagePicker.DismissModalViewController(true); }; // show the picker NavigationController.PresentModalViewController (imagePicker, true); }; btnTakePhoto.TouchUpInside += (s, e) => { try { // create a new picker controller imagePicker = new UIImagePickerController (); // set our source to the camera imagePicker.SourceType = UIImagePickerControllerSourceType.Camera; // set what media types imagePicker.MediaTypes = UIImagePickerController.AvailableMediaTypes (UIImagePickerControllerSourceType.Camera); // show the camera controls imagePicker.ShowsCameraControls = true; // attach the delegate pickerDelegate = new ImagePickerScreen.PickerDelegate (); imagePicker.Delegate = pickerDelegate; // show the picker NavigationController.PresentModalViewController (imagePicker, true); } catch { UIAlertView alert = new UIAlertView ("No Camera", "No Camera Detected!", null, "OK", null); alert.Show (); } }; btnPhotoRoll.TouchUpInside += (s, e) => { // create a new picker controller imagePicker = new UIImagePickerController (); // set our source to the camera imagePicker.SourceType = UIImagePickerControllerSourceType.SavedPhotosAlbum; // set what media types imagePicker.MediaTypes = UIImagePickerController.AvailableMediaTypes (UIImagePickerControllerSourceType.SavedPhotosAlbum); // attach the delegate pickerDelegate = new ImagePickerScreen.PickerDelegate (); imagePicker.Delegate = pickerDelegate; // show the picker NavigationController.PresentModalViewController (imagePicker, true); }; }