protected virtual async Task SetupSvgImg()
        {
            if (Component != null)
            {
                return;
            }

            string svgClass = Spin ? "anticon-spin" : null;

            if (!string.IsNullOrEmpty(IconFont))
            {
                var svg = $"<svg><use xlink:href=#{IconFont} /></svg>";
                _svgImg = IconService.GetStyledSvg(svg, svgClass, Width, Height, Fill, Rotate);

                StateHasChanged();
            }
            else
            {
                await Task.Run(async() =>
                {
                    var svg = await IconService.GetIconImg(Type.ToLowerInvariant(), Theme.ToLowerInvariant());
                    _svgImg = IconService.GetStyledSvg(svg, svgClass, Width, Height, Fill, Rotate);
                    await InvokeAsync(StateHasChanged);
                });
            }
        }
Exemple #2
0
        private async ValueTask LoadImage()
        {
            if (!IsImage)
            {
                return;
            }

            var iconType = DetermineIconType();

            _svgImage = await IconService.GetIconImg(iconType.type, iconType.theme);
        }
Exemple #3
0
        private void LoadImage()
        {
            if (!IsImage)
            {
                return;
            }

            var iconType = DetermineIconType();

            _svgImage = IconService.GetIconImg(iconType.type, iconType.theme);
        }
Exemple #4
0
        protected virtual async Task SetupSvgImg()
        {
            if (Component != null)
            {
                return;
            }

            if (!string.IsNullOrEmpty(IconFont))
            {
                var svg = $"<svg><use xlink:href=#{IconFont} /></svg>";
                _svgImg = IconService.GetStyledSvg(svg, Width, Height, Fill);
            }
            else
            {
                var svg = await IconService.GetIconImg(Type.ToLowerInvariant(), Theme.ToLowerInvariant());

                _svgImg = IconService.GetStyledSvg(svg, Width, Height, Fill);
            }

            StateHasChanged();
        }