oi-metrology/View/Pages/Index.razor.cs
2023-02-16 15:17:31 -07:00

32 lines
2.0 KiB
C#

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 = "<svg width='24px' height='24px' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='feather feather-refresh-ccw'><polyline points='1 4 1 10 7 10'></polyline><polyline points='23 20 23 14 17 14'></polyline><path d='M20.49 9A9 9 0 0 0 5.64 5.64L1 10m22 4l-4.64 4.36A9 9 0 0 1 3.51 15'></path></svg>";
string brushIcon = "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' aria-labelledby='bqbrush-desc bqbrush-title'><title id='bqbrush-title'>Brush Icon</title><desc id='bqbrush-desc'>A picture showing a painting brush.</desc><path d='M13.093 6.743a1.074 1.074 0 011.306.251l.237.237-6.4 6.4-.242-.231a1.074 1.074 0 01-.251-1.306c.446-.693 1.553-2.516.515-3.554-1.584-1.585-2.225-.94-3.809-2.528S2.714 3 3.354 2.354s2.073-.489 3.658 1.095.943 2.225 2.527 3.809c1.038 1.042 2.861-.069 3.554-.515zm6.93 5.874L15.31 7.9 8.9 14.31l4.433 4.433c-.039.159-.084.327-.137.508 0 0-.8 2.749.8 2.749s.8-2.749.8-2.749a10.75 10.75 0 01-.272-1.14L16.2 16.44a8.944 8.944 0 00-2.072-3.314s.555-.545 3.323 2.063l.811-.811-1.54-2.5 2.5 1.539z'/></svg>";
_ = BrushIconRef.EnsureReady().ContinueWith(new Action<Task>((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;
}
}