using Microsoft.AspNetCore.Components; using Microsoft.JSInterop; using MP.Core.DTO; using Blazored.LocalStorage; namespace MP.INVE.Components { public partial class NavMenuTerm { private bool collapseNavMenu = true; private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null; private void ToggleNavMenu() { collapseNavMenu = !collapseNavMenu; } protected string cssScan = ""; protected string cssCanc = ""; protected string cssScanBack = ""; protected string cssCancBack = ""; protected string cssCancScan = ""; protected string authKey = ""; protected int idOpr = 0; protected override async Task OnInitializedAsync() { await Task.Delay(1); if (isScan) { cssCancScan = "bg-info"; cssScanBack = "background-color: rgba(255,255,255,0.7)"; cssScan = "fw-bold text-decoration-underline"; } else { cssCancScan = "bg-danger"; cssCancBack = "background-color: rgba(255,255,255,0.7)"; cssCanc = "fw-bold text-decoration-underline"; } // verifico se sia tutto OK (sessione aperta) } protected bool showText { get; set; } = true; protected void ToggleCompress() { showText = !showText; EC_compressUpdated.InvokeAsync(showText); } protected async Task goBack() { if (NavManager.Uri.Contains("")) await JSRuntime.InvokeVoidAsync("history.go", -1); } protected async Task changeSess() { var currSess = await localStorage.GetItemAsync("SessioneCorrente"); if(currSess != null) { authKey = currSess.hashAuthKey; idOpr = currSess.MatrOpr; NavManager.NavigateTo($"Jumper?MatrOpr={idOpr}&UserAuthKey={authKey}"); } } protected string hideText { get => showText ? "" : "invisible"; } [Parameter] public EventCallback EC_compressUpdated { get; set; } [Parameter] public bool isScan { get; set; } = false; [Parameter] public string link { get; set; } = ""; [Inject] protected ILocalStorageService localStorage { get; set; } = null!; [Inject] protected NavigationManager NavManager { get; set; } = null!; [Inject] protected IJSRuntime JSRuntime { get; set; } = null!; } }