79 lines
1.9 KiB
C#
79 lines
1.9 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.AspNetCore.Components.Authorization;
|
|
using Microsoft.JSInterop;
|
|
using StockMan.CORE.Data;
|
|
|
|
namespace StockMan.CORE.Components
|
|
{
|
|
public partial class CmpTop
|
|
{
|
|
#region Public Methods
|
|
|
|
public async Task flushCache()
|
|
{
|
|
await Task.Delay(1);
|
|
await SDService.FlushRedisCache();
|
|
await Task.Delay(1);
|
|
// rimando a pagina corrente
|
|
NavManager.NavigateTo(NavManager.Uri, true);
|
|
}
|
|
|
|
#endregion Public Methods
|
|
|
|
#region Protected Properties
|
|
|
|
[Inject]
|
|
protected IJSRuntime JSRuntime { get; set; } = null!;
|
|
|
|
[Inject]
|
|
protected StockDataService SDService { get; set; } = null!;
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
await forceReload();
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private string userName = "";
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Private Properties
|
|
|
|
[Inject]
|
|
private NavigationManager NavManager { get; set; } = null!;
|
|
|
|
#endregion Private Properties
|
|
|
|
#region Private Methods
|
|
|
|
private async Task forceReload()
|
|
{
|
|
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
|
var user = authState.User;
|
|
if (user.Identity != null && user.Identity.IsAuthenticated)
|
|
{
|
|
userName = $"{user.Identity.Name}";
|
|
}
|
|
else
|
|
{
|
|
userName = "N.A.";
|
|
}
|
|
}
|
|
|
|
private async void MService_EA_ShowSearch()
|
|
{
|
|
await Task.Delay(1);
|
|
await InvokeAsync(() => StateHasChanged());
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |