예제 #1
0
        /// <inheritdoc />
        public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear(animated);

            AlbumView.LayoutIfNeeded();
            _cameraView.LayoutIfNeeded();

            var albumDataSource = LazyDataSource(AlbumView, AlbumView.CellSize, MediaTypes);
            var albumDelegate   = LazyDelegate(AlbumView, albumDataSource);

            AlbumDataSource = albumDataSource;
            AlbumDelegate   = albumDelegate;

            var local = AlbumDataSource as LocalFilesDataSource;

            if (local != null)
            {
                local.InitialSelectedImagePath = InitialSelectedImagePath;
            }

            AlbumView.Initialize(AlbumDataSource, AlbumDelegate);
            _cameraView.Initialize(OnImageFinished);

            local?.ShowFirstImage();

            if (HasVideo)
            {
                _videoView.LayoutIfNeeded();
                _videoView.Initialize(OnVideoFinished);
                _videoView.CameraUnauthorized += OnCameraUnauthorized;
            }

            _libraryButton.TouchUpInside += LibraryButtonPressed;
            _menuView.Closed             += CloseButtonPressed;
            _menuView.Done += DoneButtonPressed;
            _cameraButton.TouchUpInside += CameraButtonPressed;
            _videoButton.TouchUpInside  += VideoButtonPressed;

            AlbumDataSource.CameraRollUnauthorized += OnCameraRollUnauthorized;
            _cameraView.CameraUnauthorized         += OnCameraUnauthorized;

            switch (Configuration.ModeOrder)
            {
            case ModeOrder.CameraFirst:
                ChangeMode(Mode.Camera);
                break;

            case ModeOrder.VideoFirst:
                ChangeMode(HasVideo ? Mode.Video : Mode.Library);     // Fallback to Library if the Video is disabled
                break;

            case ModeOrder.LibraryFirst:
                ChangeMode(Mode.Library);
                break;
            }
        }
예제 #2
0
        /// <inheritdoc />
        public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear(animated);

            _menu.Done    += OnDone;
            _menu.Closed  += OnClosed;
            _menu.Extra   += OnExtra;
            _menu.Deleted += OnDelete;

            AlbumDataSource = LazyDataSource(_album, CellSize, MediaTypes);
            AlbumDelegate   = LazyDelegate(_album, AlbumDataSource);

            var local = AlbumDataSource as LocalFilesDataSource;

            if (local != null)
            {
                local.InitialSelectedImagePath = InitialSelectedImagePath;
            }

            _album.Initialize(AlbumDataSource, AlbumDelegate);

            local?.ShowFirstImage();
        }