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