using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Components; using System.Net.Http; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Components.Authorization; using Microsoft.AspNetCore.Components.Forms; using Microsoft.AspNetCore.Components.Routing; using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.Components.Web.Virtualization; using Microsoft.JSInterop; using MP.INVE; using MP.INVE.Shared; using MP.INVE.Components; using MP.INVE.Data; using MP.Data.DTO; using Blazored.LocalStorage; namespace MP.INVE.Shared { public partial class NavMenu { private bool collapseNavMenu = true; //public List? ElencoLink { get; set; } private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null; private void ToggleNavMenu() { collapseNavMenu = !collapseNavMenu; } protected string userName { get; set; } = "0"; protected async Task getId() { OperatoreDTO answ = new OperatoreDTO(); answ = await localStorage.GetItemAsync("MatrOpr"); if (answ != null) { userName = $"{answ.Cognome} {answ.Nome} ({answ.MatrOpr})"; if (NavigationManager.Uri.Contains("OperatoreLogin")) { NavigationManager.NavigateTo("Starter", true); } } else { userName = "0"; if (!NavigationManager.Uri.Contains("OperatoreLogin")) { NavigationManager.NavigateTo("OperatoreLogin", true); } } } protected override async Task OnInitializedAsync() { // recupero elenco JQM //ElencoLink = await MDService.ElencoLink(); await getId(); } protected bool showText { get; set; } = true; protected void ToggleCompress() { showText = !showText; EC_compressUpdated.InvokeAsync(showText); } protected string hideText { get => showText ? "" : "invisible"; } [Parameter] public EventCallback EC_compressUpdated { get; set; } [Inject] protected ILocalStorageService localStorage { get; set; } = null!; [Inject] protected NavigationManager NavigationManager { get; set; } = null!; } }