Files
2025-03-29 09:42:00 +01:00

73 lines
2.3 KiB
Plaintext

@page "/force-reset"
<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 navManager { get; set; } = null!;
[Inject]
protected MessageService MsgServ { get; set; } = null!;
private int currVal = 0;
private int nextVal = 0;
private int expTimeMsec = 10;
private int bDelay = 350;
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);
// svuoto cache
MsgServ.LastIdxMacchina = "";
await Task.Delay(bDelay);
title = "Clearing Local Browser Data";
currVal = 10;
nextVal = 30;
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);
navManager.NavigateTo("Index", true);
}
}