Viewer to Server
This commit is contained in:
34
View/Pages/RunHeaders.razor.cs
Normal file
34
View/Pages/RunHeaders.razor.cs
Normal file
@ -0,0 +1,34 @@
|
||||
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 = "<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path d='M22.7 19l-9.1-9.1c.9-2.3.4-5-1.5-6.9-2-2-5-2.4-7.4-1.3L9 6 6 9 1.6 4.7C.4 7.1.9 10.1 2.9 12.1c1.9 1.9 4.6 2.4 6.9 1.5l9.1 9.1c.4.4 1 .4 1.4 0l2.3-2.3c.5-.4.5-1.1.1-1.4z'/></svg>";
|
||||
_ = IconRef.EnsureReady().ContinueWith(new Action<Task>((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;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user