Files
mapo-core/MP.SPEC/Pages/ForceReset.razor
T
Samuele Locatelli d344b49ff0 SPEC:
- continuo implementazione gestione KIT
2025-04-10 19:14:59 +02:00

85 lines
2.7 KiB
Plaintext

@page "/force-reset"
@using MP.SPEC.Data
<div class="d-flex justify-content-around">
<div class="col-12 col-md-10 col-lg-8 col-xl-6 ">
<div class="card shadow mt-5">
<div class="card-header">
<img class="img-fluid" src="./images/LogoMapoFull.png" />
</div>
<div class="card-body">
<ProgressDisplay RefreshInterval="50" Title="@title" MaxVal="100" CurrVal="@currVal" NextVal="@nextVal" ExpTimeMSec="@expTimeMsec" DisplaySize="ProgressDisplay.ModalSize.Medium"></ProgressDisplay>
<LoadingData DisplaySize="LoadingData.CtrlSize.Large" Title="Cleaning Up cache..." DisplayMode="LoadingData.SpinMode.Growl"></LoadingData>
</div>
</div>
</div>
</div>
@code {
[Inject]
protected NavigationManager NavMan { get; set; } = null!;
[Inject]
protected MsgServiceSpec MsgServ { get; set; } = null!;
[Inject]
protected MpDataService MDService { get; set; } = null!;
private int currVal = 0;
private int nextVal = 0;
private int expTimeMsec = 10;
private int bDelay = 150;
private string title = "...";
/// <summary>
/// Esecuzione task di reset...
/// </summary>
/// <returns></returns>
protected override async Task OnInitializedAsync()
{
title = "Reset and Reload Data";
currVal = 0;
nextVal = 10;
await InvokeAsync(StateHasChanged);
await Task.Delay(bDelay);
// title = "Clearing Local Browser Data";
// currVal = 10;
// nextVal = 30;loca
// await InvokeAsync(StateHasChanged);
// await MsgServ.ClearLocalStor();
// await Task.Delay(bDelay);
// title = "Clearing Session Browser Data";
// currVal = 30;
// nextVal = 50;
// await InvokeAsync(StateHasChanged);
// await MsgServ.ClearSessionStor();
// await Task.Delay(bDelay);
// title = "Final Cache cleanup...";
// currVal = 50;
// nextVal = 80;
// MsgServ.RigaOper = null;
// MsgServ.LastIdxMacchina = "";
// await InvokeAsync(StateHasChanged);
// await Task.Delay(2 * bDelay);
// // attendo
// title = "Reload!";
// currVal = 80;
// nextVal = 100;
// await InvokeAsync(StateHasChanged);
// // rimando alla home...
// await Task.Delay(bDelay);
// NavMan.NavigateTo("Index", true);
await Task.Delay(bDelay);
await MDService.FlushRedisCache();
title = "Reload!";
currVal = 80;
nextVal = 100;
await InvokeAsync(StateHasChanged);
await Task.Delay(bDelay);
// rimando a pagina corrente
NavMan.NavigateTo("Index", true);
}
}