Exemplo n.º 1
0
        public UIMultiPhotoSelectorView(CGRect frame, ObservableCollection <UIImage> photos) : base(frame)
        {
            Photos = photos;
            controlsOverlayView                 = new UIMultiPhotoSelectorControlsOverlayView();
            currentImage                        = new UIImageView(frame);
            takenPhotosOverlayView              = new UICurrentTakenPhotosOverlayView(frame, Photos);
            takenPhotosOverlayView.Hidden       = false;
            takenPhotosOverlayView.ImageTapped += TakenPhotosOverlayView_ImageTapped;

            AddSubview(currentImage);
            AddSubview(controlsOverlayView);
            AddSubview(takenPhotosOverlayView);

            controlsOverlayView.CloseButtonTouched += ControlsOverlayView_CloseButtonTouched;
            controlsOverlayView.TrashButtonTouched += ControlsOverlayView_TrashButtonTouched;
            controlsOverlayView.SendButtonTouched  += ControlsOverlayView_SendButtonTouched;
        }
Exemplo n.º 2
0
        public UIPhotoTakerView(CameraOptions options)
        {
            Photos = new ObservableCollection <UIImage>();
            Photos.CollectionChanged += Images_CollectionChanged;

            cameraPreview       = new UICameraPreview(options);
            controlsOverlayView = new UIPhotoTakerControlsOverlayView(Frame);
            // latestPhotosOverlayView = new UILatestPhotosOverlayView(this.Frame);

            takenPhotosOverlayView              = new UICurrentTakenPhotosOverlayView(Frame, Photos);
            takenPhotosOverlayView.Hidden       = true;
            takenPhotosOverlayView.ImageTapped += TakenPhotosOverlayView_ImageTapped;

            photoEditorView        = new UIPhotoEditorView(Frame);
            photoEditorView.Hidden = true;

            multiPhotoSelectorView        = new UIMultiPhotoSelectorView(Frame, Photos);
            multiPhotoSelectorView.Hidden = true;

            /*
             * slider = new UISlider();
             * slider.ValueChanged += Slider_ValueChanged;
             * slider.MinValue = 1f;
             * slider.SendActionForControlEvents(UIControlEvent.TouchDragInside);
             */
            AddSubview(cameraPreview);
            AddSubview(controlsOverlayView);
            // AddSubview(slider);

            // - AddSubview(latestPhotosOverlayView);
            AddSubview(takenPhotosOverlayView);
            AddSubview(multiPhotoSelectorView);
            AddSubview(photoEditorView);

            // Register all events...
            controlsOverlayView.TakeButtonTouched    += ControlsOverlayView_TakeButtonTouched;
            controlsOverlayView.FlashButtonTouched   += ControlsOverlayView_FlashButtonTouched;
            controlsOverlayView.CloseButtonTouched   += ControlsOverlayView_CloseButtonTouched;
            controlsOverlayView.CameraButtonTouched  += ControlsOverlayView_CameraButtonTouched;
            controlsOverlayView.SendButtonTouched    += ControlsOverlayView_SendButtonTouched;
            controlsOverlayView.CounterButtonTouched += ControlsOverlayView_CounterButtonTouched;

            photoEditorView.CloseButtonTapped += PhotoEditorView_CloseButtonTapped;
            photoEditorView.TrashButtonTapped += PhotoEditorView_TrashButtonTapped;

            multiPhotoSelectorView.CloseButtonTapped += MultiPhotoSelectorView_CloseButtonTapped;
            multiPhotoSelectorView.TrashButtonTapped += MultiPhotoSelectorView_TrashButtonTapped;

            var panGestureRecognizer = new UIPinchGestureRecognizer((gesture) =>
            {
                if (gesture.State == UIGestureRecognizerState.Began || gesture.State == UIGestureRecognizerState.Changed)
                {
                    var result = cameraPreview.SetZoom((float)gesture.Scale);

                    /*
                     * slider.ValueChanged -= Slider_ValueChanged;
                     * slider.Value = result;
                     * slider.ValueChanged += Slider_ValueChanged;
                     */
                }
                gesture.Scale = 1.0f;
            });

            // slider.MaxValue = cameraPreview.GetMaxZoomFactor();

            UserInteractionEnabled = true;

            AddGestureRecognizer(panGestureRecognizer);
        }