Exemplo n.º 1
0
 partial void ShowGalleryButton_TouchUpInside(UIButton sender)
 {
     using (MWPhotoBrowser photoBrowser = new MWPhotoBrowser(this))
     {
         NavigationController.PushViewController(photoBrowser, true);
     }
 }
        public void Show()
        {
            _photos = new List <MWPhoto>();

            foreach (Photo p in _photoBrowser.Photos)
            {
                MWPhoto mp = MWPhoto.FromUrl(new Foundation.NSUrl(p.URL));

                if (!string.IsNullOrWhiteSpace(p.Title))
                {
                    mp.Caption = p.Title;
                }

                _photos.Add(mp);
            }

            MWPhotoBrowser browser = new MWPhotoBrowser(this)
            {
                EnableGrid = _photoBrowser.EnableGrid,

                BrowserBackgroundColor = _photoBrowser.BackgroundColor.ToUIColor(),

                DisplayActionButton = _photoBrowser.ActionButtonPressed != null,

                ZoomPhotosToFill = _photoBrowser.iOS_ZoomPhotosToFill
            };


            browser.SetCurrentPhoto((nuint)_photoBrowser.StartIndex);


            var window = UIApplication.SharedApplication.KeyWindow;
            var vc     = window.RootViewController;

            while (vc.PresentedViewController != null)
            {
                vc = vc.PresentedViewController;
            }

            var browserNavigationController = new UINavigationController(browser);

            browserNavigationController.ModalPresentationStyle = UIModalPresentationStyle.OverFullScreen;
            browserNavigationController.ModalTransitionStyle   = UIModalTransitionStyle.CrossDissolve;

            vc.PresentViewController(browserNavigationController, true, null);
        }
Exemplo n.º 3
0
        public void Show()
        {
            _photos = new List <MWPhoto>();

            foreach (Photo p in _photoBrowser.Photos)
            {
                MWPhoto mp = MWPhoto.FromUrl(new Foundation.NSUrl(p.URL));

                if (!string.IsNullOrWhiteSpace(p.Title))
                {
                    mp.Caption = p.Title;
                }

                _photos.Add(mp);
            }

            MWPhotoBrowser browser = new MWPhotoBrowser(this)
            {
                EnableGrid = _photoBrowser.EnableGrid,

                BrowserBackgroundColor = _photoBrowser.BackgroundColor.ToUIColor(),

                DisplayActionButton = _photoBrowser.ActionButtonPressed != null,

                ZoomPhotosToFill = _photoBrowser.iOS_ZoomPhotosToFill
            };

            browser.WantsFullScreenLayout = true;
            browser.SetCurrentPhoto((nuint)_photoBrowser.StartIndex);
            browser.View.BackgroundColor = _photoBrowser.BackgroundColor.ToUIColor();

            var window = UIApplication.SharedApplication.KeyWindow;
            var vc     = window.RootViewController;

            while (vc.PresentedViewController != null)
            {
                vc = vc.PresentedViewController;
            }
            var viewController = new UINavigationController(browser);

            //double iOSVersion = double.Parse(UIDevice.CurrentDevice.SystemVersion);
            //if(iOSVersion >= 13)
            //    viewController.ModalPresentationStyle = UIModalPresentationStyle.FullScreen;
            viewController.View.BackgroundColor = _photoBrowser.BackgroundColor.ToUIColor();
            vc.PresentViewController(viewController, true, null);
        }
Exemplo n.º 4
0
        public void Show()
        {
            _photos = new List <MWPhoto>();

            foreach (Photo p in _photoBrowser.Photos)
            {
                MWPhoto mp = MWPhoto.FromUrl(new Foundation.NSUrl(p.URL));
                mp.Caption = p.Title;

                _photos.Add(mp);
            }

            MWPhotoBrowser browser = new MWPhotoBrowser(this);

            browser.DisplayActionButton = _photoBrowser.ActionButtonPressed != null;
            browser.SetCurrentPhoto((nuint)_photoBrowser.StartIndex);

            UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController(new UINavigationController(browser), true, null);
        }
Exemplo n.º 5
0
        public async void Show()
        {
            _photos = new List <MWPhoto>();

            foreach (Photo p in _photoBrowser.Photos)
            {
                MWPhoto mp;
                if (p.URL.EndsWith(".svg", StringComparison.InvariantCulture))
                {
                    mp = MWPhoto.FromImage(
                        await ImageService.Instance
                        .LoadFileFromApplicationBundle(p.URL)
                        .WithCustomDataResolver(new SvgDataResolver(0, 0, true))
                        .WithCustomLoadingPlaceholderDataResolver(new SvgDataResolver(0, 0, true))
                        .AsUIImageAsync());
                }
                else
                {
                    mp = MWPhoto.FromUrl(new Foundation.NSUrl(p.URL));
                }

                if (!string.IsNullOrWhiteSpace(p.Title))
                {
                    mp.Caption = p.Title;
                }

                _photos.Add(mp);
            }

            MWPhotoBrowser browser = new MWPhotoBrowser(this);

            browser.DisplayActionButton = _photoBrowser.ActionButtonPressed != null;
            browser.SetCurrentPhoto((nuint)_photoBrowser.StartIndex);
            browser.EnableGrid = _photoBrowser.EnableGrid;

            UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController(new UINavigationController(browser), true, null);
        }
Exemplo n.º 6
0
        public void Show()
        {
            _photos = new List <MWPhoto>();

            foreach (ImageModel p in _photoBrowser.Photos)
            {
                MWPhoto mp = MWPhoto.FromUrl(new Foundation.NSUrl(p.Path));

                if (!string.IsNullOrWhiteSpace(p.Name))
                {
                    mp.Caption = p.Name;
                }

                _photos.Add(mp);
            }

            MWPhotoBrowser browser = new MWPhotoBrowser(this);

            browser.DisplayActionButton = _photoBrowser.ActionButtonPressed != null;
            browser.SetCurrentPhoto((nuint)_photoBrowser.StartIndex);
            browser.EnableGrid = _photoBrowser.EnableGrid;

            UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController(new UINavigationController(browser), true, null);
        }
 public override void OnActionButtonPressed(MWPhotoBrowser photoBrowser, nuint index)
 {
     _photoBrowser.ActionButtonPressed?.Invoke((int)index);
 }
 public override nuint NumberOfPhotosInPhotoBrowser(MWPhotoBrowser photoBrowser) => (nuint)_photos.Count;
 public override MWPhoto GetPhoto(MWPhotoBrowser photoBrowser, nuint index) => _photos[(int)index];
Exemplo n.º 10
0
 public override void DidDisplayPhoto(MWPhotoBrowser photoBrowser, nuint index)
 {
     _photoBrowser.DidDisplayPhoto?.Invoke((int)index);
 }
Exemplo n.º 11
0
 public override MWPhoto GetThumbnail(MWPhotoBrowser photoBrowser, nuint index) => _photosThumbnail[(int)index];
Exemplo n.º 12
0
 public nuint NumberOfPhotosInPhotoBrowser(MWPhotoBrowser photoBrowser) => (nuint)photos.Count;
Exemplo n.º 13
0
 public MWPhoto GetPhoto(MWPhotoBrowser photoBrowser, nuint index) => photos[(int)index];