/// <summary>
        /// Called when the renderer needs to display a image.
        /// </summary>
        /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
        async Task <ImageSource> IImageResolver.ResolveImageAsync(string url, string tooltip)
        {
            var eventArgs = new ImageResolvingEventArgs(url, tooltip);

            ImageResolving?.Invoke(this, eventArgs);

            await eventArgs.WaitForDeferrals();

            try
            {
                return(eventArgs.Handled
                                ? eventArgs.Image
                                : new BitmapImage(new Uri(url)));
            }
            catch (Exception)
            {
                return(null);
            }
        }
        /// <summary>
        /// Called when the renderer needs to display a image.
        /// </summary>
        /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
        async Task <ImageSource> IImageResolver.ResolveImageAsync(string url, string tooltip)
        {
            if (!Uri.TryCreate(url, UriKind.Absolute, out Uri uri))
            {
                if (!string.IsNullOrEmpty(UriPrefix))
                {
                    url = string.Format("{0}{1}", UriPrefix, url);
                }
            }

            var eventArgs = new ImageResolvingEventArgs(url, tooltip);

            ImageResolving?.Invoke(this, eventArgs);

            await eventArgs.WaitForDeferrals();

            try
            {
                return(eventArgs.Handled
                    ? eventArgs.Image
                    : GetImageSource(new Uri(url)));
            }
            catch (Exception)
            {
                return(null);
            }

            ImageSource GetImageSource(Uri imageUrl)
            {
                if (_isSvgImageSupported)
                {
                    if (Path.GetExtension(imageUrl.AbsolutePath)?.ToLowerInvariant() == ".svg")
                    {
                        return(new SvgImageSource(imageUrl));
                    }
                }

                return(new BitmapImage(imageUrl));
            }
        }