Example #1
0
        public void SelectPhotos(int index)
        {
            selected_index = index;

            if (selected_index != (PhotosModelList.Count - 1) || selected_index == 9)
            {
                var alert  = UIAlertController.Create(null, null, UIAlertControllerStyle.ActionSheet);
                var image  = UIImage.FromBundle("camera.png");
                var camera = UIAlertAction.Create("Camera ", UIAlertActionStyle.Default, (s) => { CameraBtna_TouchUpInside(); });
                camera.SetValueForKey(image, new NSString("image"));


                alert.AddAction(camera);

                var gallery     = UIAlertAction.Create("Gallery", UIAlertActionStyle.Default, (k) => { GalleryButtona_TouchUpInside(); });
                var galleryicon = UIImage.FromBundle("gallery.png");
                gallery.SetValueForKey(galleryicon, new NSString("image"));
                alert.AddAction(gallery);

                var cancelaction = UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, null);
                alert.AddAction(cancelaction);
                UIPopoverPresentationController presentationPopover = alert.PopoverPresentationController;
                if (presentationPopover != null)
                {
                    presentationPopover.SourceView = this.View;
                    presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Right;
                }
                this.PresentViewController(alert, true, null);
            }

            if (PhotosModelList.Count <= 10)
            {
                if ((PhotosModelList.Count - 1) == index)
                {
                    PhotosModelList.RemoveAt(index);
                    PhotosModelList.Add(new AddPhotoModel {
                        Image = "camera_black.png", VehicleLabel = "Additional"
                    });

                    if (PhotosModelList.Count < 10)
                    {
                        PhotosModelList.Add(new AddPhotoModel {
                            Image = "add_photo.png", VehicleLabel = "Additional"
                        });
                    }
                    AddPhotoCollectionView.ReloadData();
                }
            }
        }
Example #2
0
 public void SetAdditionalImages(string fileName)
 {
     PhotosModelList[selected_index].Image = fileName;
     AddPhotoCollectionView.ReloadData();
 }