@page "/user" @inject IJSRuntime JSRuntime @inject IHttpContextAccessor httpContextAccessor

User

@if (Width > 1021) {
}
@*
USER DATA
*@
Preferenze
  • Modalità di inserimento del tempo ciclo
  • Lingua
  • Modalità di visualizzazione delle macchine in 'Mappa Stato'
User Data
  • Prossima disconnessione:
    @($"{DateTime.Now.AddMinutes(dtScadLogin)}")
  • User
    @($"{UserName}[{MatrOpr}]")
  • Server Time
    @($"{DateTime.Now.ToString("dddd dd.MM.yyyy HH:mm.ss")}")
  • Client IP
    @currIpv4
  • Browser Size
    @($"{Width}x{Height}")
@if (Width > 1021) {
}
@code { [Inject] private MessageService MsgServ { get; set; } = null!; protected async Task setTcMode(string tcMode) { await Task.Delay(1); tcModIns = tcMode; } protected async Task setLang(string lang) { await Task.Delay(1); langIns = lang; } protected async Task setDefCardMode(string defCardMode) { await Task.Delay(1); defCardModeIns = defCardMode; } private int MatrOpr { get => MsgServ.MatrOpr; } private string UserName { get => MsgServ.CognomeNome; } protected string btnMsStyle { get { string answ = ""; if (tcModIns == "ms") { answ = "btn-primary"; } else { answ = "btn-outline-secondary"; } return answ; } } protected string btnMcStyle { get { string answ = ""; if (tcModIns == "mc") { answ = "btn-primary"; } else { answ = "btn-outline-secondary"; } return answ; } } protected string btnShrinkStyle { get { string answ = ""; if (defCardModeIns == "shrink") { answ = "btn-primary"; } else { answ = "btn-outline-secondary"; } return answ; } } protected string btnFullStyle { get { string answ = ""; if (defCardModeIns == "full") { answ = "btn-primary"; } else { answ = "btn-outline-secondary"; } return answ; } } protected string _tcModIns { get; set; } = ""; protected string tcModIns { get => _tcModIns; set { if (_tcModIns != value) { _tcModIns = value; MsgServ.UserPrefSet("TcMode", value); } } } protected string _langIns { get; set; } = "EN"; protected string langIns { get => _langIns; set { if (_langIns != value) { _langIns = value; MsgServ.UserPrefSet("Lang", value); } } } protected string _defCardMode { get; set; } = ""; protected string defCardModeIns { get => _defCardMode; set { if (_defCardMode != value) { _defCardMode = value; MsgServ.UserPrefSet("DefCardMode", value); } } } public int Height { get; set; } = 0; public int Width { get; set; } = 0; public string currIpv4 { get; set; } = ""; public class WindowDimension { public int Width { get; set; } public int Height { get; set; } } protected async override Task OnAfterRenderAsync(bool firstRender) { //await Task.Delay(500); if (firstRender) { await getWDim(); StateHasChanged(); Log.Debug($"Dimensioni schermo: {Width}x{Height}"); } } [Inject] protected SharedMemService MStor { get; set; } = null!; protected int dtScadLogin { get; set; } = 0; protected async override Task OnInitializedAsync() { tcModIns = MsgServ.UserPrefSetup("TcMode", "ms"); langIns = MsgServ.UserPrefSetup("Lang", "IT"); defCardModeIns = MsgServ.UserPrefSetup("DefCardMode", "full"); dtScadLogin = MStor.GetConfInt("TAB_dtTimerScadLogin"); await Task.Delay(1); if (string.IsNullOrEmpty(currIpv4)) { // ricalcolo e salvo... if (httpContextAccessor.HttpContext != null) { var remoteIp = $"{httpContextAccessor.HttpContext.Connection?.RemoteIpAddress}"; // provo a recuperare ipV4... currIpv4 = EgwCoreLib.Razor.Data.IpUtils.getLocalIpv4(remoteIp); } } } protected async Task getWDim() { var dimension = await JSRuntime.InvokeAsync("getWindowDimensions"); Height = dimension.Height; Width = dimension.Width; } protected string mainSize { get { string answ = "col-12"; if (Width > 1021) { answ = "col-6"; } return answ; } } private static NLog.Logger Log = LogManager.GetCurrentClassLogger(); }