Ejemplo n.º 1
0
        protected override void SetupOnBeforeImageLoading(TaskParameter imageLoader)
        {
            base.SetupOnBeforeImageLoading(imageLoader);

#if __IOS__
            int width  = (int)this.Bounds.Width;
            int height = (int)this.Bounds.Height;
#elif __ANDROID__
            int width  = this.Width;
            int height = this.Height;
#elif __WINDOWS__
            int width  = (int)this.Width;
            int height = (int)this.Height;
#endif

            if ((!string.IsNullOrWhiteSpace(ImagePath) && ImagePath.IsSvgFileUrl()) || ImageStream != null)
            {
                imageLoader.WithCustomDataResolver(new SvgDataResolver(width, height, true, ReplaceStringMap));
            }
            if (!string.IsNullOrWhiteSpace(LoadingPlaceholderImagePath) && LoadingPlaceholderImagePath.IsSvgFileUrl())
            {
                imageLoader.WithCustomLoadingPlaceholderDataResolver(new SvgDataResolver(width, height, true, ReplaceStringMap));
            }
            if (!string.IsNullOrWhiteSpace(ErrorPlaceholderImagePath) && ErrorPlaceholderImagePath.IsSvgFileUrl())
            {
                imageLoader.WithCustomErrorPlaceholderDataResolver(new SvgDataResolver(width, height, true, ReplaceStringMap));
            }
        }