Пример #1
0
        protected async override void OnElementChanged(ElementChangedEventArgs <Swiper> e)
        {
            base.OnElementChanged(e);

            if (this.Element == null)
            {
                return;
            }

            _leftImageView  = CreateImageView();
            _rightImageView = CreateImageView();

            _centerImageView = CreateImageView();
            _centerImageView.UserInteractionEnabled = true;
            _centerImageView.AddGestureRecognizer(new UIPanGestureRecognizer(OnPan));
            _centerImageView.AddGestureRecognizer(new UITapGestureRecognizer(OnTapped));

            UpdateSizes();

            _rootView             = new UIView();
            _rootView.ContentMode = UIViewContentMode.ScaleAspectFit;
            _rootView.AddSubview(_centerImageView);
            _rootView.AddSubview(_leftImageView);
            _rootView.AddSubview(_rightImageView);

            this.SetNativeControl(_rootView);

            if (this.Element.Width > 0 && this.Element.Height > 0)
            {
                await InitializeImagesAsync();
            }
        }
Пример #2
0
        private async Task LoadImage(AsyncUIImageView view, string url)
        {
            view.Image = null;
            if (!IsInCache(url))
            {
                view.IsLoading();
            }

            view.Image = await ResolveImageAsync(url);

            view.IsLoaded();
        }