Exemplo n.º 1
0
        public override void ViewDidLoad()
        {
            _pageViewController = new MyPageViewController(this);
            //            {
            //                GetNextViewController = GetNextViewController,
            //                GetPreviousViewController = GetPreviousViewController,
            //            };
            //            _pageViewDataSource = new MyDataSource(this);
            //            _pageViewController.DataSource = _pageViewDataSource;

            var firstPage = new PhotoPage(this, _currentImageIndex, _images);
            _pageViewController.SetViewControllers(new UIViewController[] { firstPage },
                UIPageViewControllerNavigationDirection.Forward,
                false, null);

            _pageViewController.View.Frame = View.Bounds;
            View.AddSubview(_pageViewController.View);
        }
Exemplo n.º 2
0
        private void OnDeleteAssetsCompleted(ImageEntity removedImage, bool result, NSError error)
        {
            if (result == false)
            {
                return;
            }
            else
            {
                Console.WriteLine(error);
            }
            int imageIndex = GetImageIndex(removedImage);
            _images.Remove(removedImage);
            _imageCache.Remove(removedImage);

            InvokeOnMainThread(() =>
            {
                _pageViewController.ResetDataSource();

                if (_images.IsNullOrEmpty())
                {
                    NavigationController.PopViewController(true);
                    return;
                }
                var page = new PhotoPage(this, _currentImageIndex, _images);

                imageIndex--;
                if (imageIndex < 0)
                {
                    imageIndex = 0;
                }
                _pageViewController.SetViewControllers(new UIViewController[] { page },
                    UIPageViewControllerNavigationDirection.Forward,
                    false, null);
            });
        }