oi-metrology/ClientHub/Pages/RunInfo.razor.cs
2023-01-15 18:40:32 -07:00

27 lines
951 B
C#

using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
namespace OI.Metrology.ClientHub.Pages;
public partial class RunInfo
{
[Parameter] public Metrology.Shared.ViewModels.RunInfo? Model { get; set; }
[Inject] protected IJSRuntime? JSRuntime { get; set; }
protected override Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
if (JSRuntime is null)
throw new NullReferenceException(nameof(JSRuntime));
int initialToolTypeID = Model is not null ? Model.ToolTypeID : 0;
int initialHeaderId = Model is not null ? Model.HeaderID : 0;
string initialHeaderAttachmentId = Model is not null ? Model.HeaderAttachmentID.ToString() : string.Empty;
return JSRuntime.InvokeVoidAsync("initRunInfo", initialToolTypeID, initialHeaderId, initialHeaderAttachmentId).AsTask();
}
return Task.CompletedTask;
}
}