oi-metrology/ClientHub/Pages/Export.razor.cs
2023-01-19 16:45:16 -07:00

36 lines
1.0 KiB
C#

using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
namespace OI.Metrology.ClientHub.Pages;
public partial class Export
{
[Inject] protected IJSRuntime? JSRuntime { get; set; }
[Inject] protected Models.AppSettings? AppSettings { get; set; }
[Parameter] public Metrology.Shared.ViewModels.Export? Model { get; set; }
public Export()
{
Model ??= new()
{
ToolType = "",
StartTime = DateTime.Now.AddMonths(-1),
EndTime = DateTime.Now
};
}
protected override Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
if (JSRuntime is null)
throw new NullReferenceException(nameof(JSRuntime));
if (AppSettings is null)
throw new NullReferenceException(nameof(AppSettings));
return JSRuntime.InvokeVoidAsync("initExport", AppSettings.ApiUrl, DateTime.Now.AddMonths(-1), DateTime.Now).AsTask();
}
return Task.CompletedTask;
}
}