103 lines
2.9 KiB
Plaintext
103 lines
2.9 KiB
Plaintext
@using NLog;
|
|
@inherits LayoutComponentBase
|
|
|
|
@inject NavigationManager NavMan
|
|
@inject ListSelectDataSrv MDataService
|
|
@inject SharedMemService MStor
|
|
|
|
<div class="page">
|
|
<main>
|
|
<div class="top-row d-flex justify-content-between">
|
|
<div class="col-4">
|
|
<span>
|
|
<button class="btn btn-sm @ResetClass" @onclick="() => ForceReload()" title="Update"><i class="fa-solid fa-rotate"></i></button>
|
|
Username
|
|
</span>
|
|
<sub>[999]</sub>
|
|
</div>
|
|
<div class="col-4 text-center">
|
|
<a href="status-map" class="text-decoration-none text-light">
|
|
MapoTAB2
|
|
</a>
|
|
</div>
|
|
<div class="col-4 text-end">
|
|
<button class="btn btn-sm btn-dark" @onclick="() => OnYes()">Yes!</button>
|
|
<div class="row w-100 slideMen">
|
|
<div class="">
|
|
<SlideMenu MenuItems="@CurrMenuItems"></SlideMenu>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<article class="content d-flex">
|
|
<div class="" id="mainBody">
|
|
@Body
|
|
</div>
|
|
<div class="sidebar" id="barLat">
|
|
<NavMenu MenuItems="@CurrMenuItems"></NavMenu>
|
|
</div>
|
|
</article>
|
|
</main>
|
|
</div>
|
|
|
|
<div id="blazor-error-ui">
|
|
An unhandled error has occurred.
|
|
<a href="" class="reload">Reload</a>
|
|
<a class="dismiss">🗙</a>
|
|
</div>
|
|
|
|
|
|
@code {
|
|
/// <summary>
|
|
/// Elenco items da menù per pagina corrente...
|
|
/// </summary>
|
|
protected List<LinkMenu> CurrMenuItems { get; set; } = new List<LinkMenu>();
|
|
|
|
/// <summary>
|
|
/// Livello corrente del menu
|
|
/// </summary>
|
|
protected string CurrLevel { get; set; } = "";
|
|
|
|
protected string ResetClass = "btn-primary";
|
|
|
|
/// <summary>
|
|
/// Init struttura dati
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
CurrLevel = MStor.PageLevel(NavMan.Uri);
|
|
if (MStor.DictMenu.ContainsKey(CurrLevel))
|
|
{
|
|
CurrMenuItems = MStor.DictMenu[CurrLevel];
|
|
}
|
|
else
|
|
{
|
|
CurrMenuItems = await MDataService.ListLinkFilt(CurrLevel);
|
|
MStor.DictMenu.Add(CurrLevel, CurrMenuItems);
|
|
}
|
|
await Task.Delay(1);
|
|
}
|
|
|
|
private static Logger Log = LogManager.GetCurrentClassLogger();
|
|
|
|
protected async Task ForceReload()
|
|
{
|
|
Log.Info("Start ForceReload");
|
|
ResetClass = "btn-warning";
|
|
await InvokeAsync(StateHasChanged);
|
|
await MDataService.FlushCache();
|
|
MStor.ResetCache();
|
|
await Task.Delay(200);
|
|
ResetClass = "btn-primary";
|
|
await InvokeAsync(StateHasChanged);
|
|
Log.Info("END ForceReload");
|
|
}
|
|
|
|
|
|
private void OnYes()
|
|
{
|
|
Console.WriteLine($"{DateTime.Now} | 'Yes' button selected.");
|
|
}
|
|
} |