using IgniteUI.Blazor.Controls;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
namespace OI.Metrology.View;
public partial class Index
{
    [Inject] protected IJSRuntime? JSRuntime { get; set; }
    protected IgbIcon? BrushIconRef { get; set; }
    protected override Task OnAfterRenderAsync(bool firstRender)
    {
        if (firstRender && BrushIconRef is not null)
        {
            string refreshIcon = "";
            string brushIcon = "";
            _ = BrushIconRef.EnsureReady().ContinueWith(new Action((e) =>
                 BrushIconRef.RegisterIconFromTextAsync("brush", brushIcon, "material")));
        }
        if (firstRender)
        {
            if (JSRuntime is null)
                throw new NullReferenceException(nameof(JSRuntime));
            return JSRuntime.InvokeVoidAsync("initIndex").AsTask();
        }
        return Task.CompletedTask;
    }
}