36 lines
1.0 KiB
C#
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;
|
|
}
|
|
|
|
} |