Exemplo n.º 1
0
        public static CaptureSession Create(Func <CameraCollectionViewCell> getCameraCellFunc,
                                            ImagePickerControllerDelegate imagePickerDelegate, CameraMode mode)
        {
            var captureSessionDelegate = new CaptureSessionDelegate(getCameraCellFunc);

            CaptureSession session;

            switch (mode)
            {
            case CameraMode.Photo:
            case CameraMode.PhotoAndLivePhoto:
                session = new CaptureSession(captureSessionDelegate,
                                             new SessionPhotoCapturingDelegate(getCameraCellFunc, imagePickerDelegate));
                break;

            case CameraMode.PhotoAndVideo:
                session = new CaptureSession(captureSessionDelegate,
                                             new CaptureSessionVideoRecordingDelegate(getCameraCellFunc));
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(mode), mode, null);
            }

            session.PresetConfiguration = mode.CaptureSessionPresetConfiguration();

            return(session);
        }