aggiunto auto logout
This commit is contained in:
@@ -1,9 +1,18 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MP.Data.Services;
|
||||
using NLog;
|
||||
|
||||
namespace MP_TAB_SERV.Components
|
||||
{
|
||||
public partial class CmpFooter : IDisposable
|
||||
{
|
||||
[Inject]
|
||||
protected SharedMemService SMServ { get; set; } = null!;
|
||||
[Inject]
|
||||
protected MessageService MsgServ { get; set; } = null!;
|
||||
[Inject]
|
||||
protected NavigationManager NavMan { get; set; } = null!;
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
@@ -18,10 +27,16 @@ namespace MP_TAB_SERV.Components
|
||||
|
||||
public void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
var diffOfTime = DateTime.Now - MsgServ.dtLastAction;
|
||||
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(() => StateHasChanged());
|
||||
if(diffOfTime.Minutes > dtTimerScadenzaLogin)
|
||||
{
|
||||
NavMan.NavigateTo("logout");
|
||||
}
|
||||
//Log.Trace("CmpFooter Timer elapsed");
|
||||
});
|
||||
pUpd.Wait();
|
||||
@@ -29,7 +44,7 @@ namespace MP_TAB_SERV.Components
|
||||
|
||||
public void StartTimer()
|
||||
{
|
||||
int tOutPeriod = 5000;
|
||||
int tOutPeriod = dtTimerScadenzaLogin * 60000;
|
||||
aTimer = new System.Timers.Timer(tOutPeriod);
|
||||
aTimer.Elapsed += ElapsedTimer;
|
||||
aTimer.Enabled = true;
|
||||
@@ -40,12 +55,24 @@ namespace MP_TAB_SERV.Components
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override void OnInitialized()
|
||||
int dtTimerScadenzaLogin { get; set; } = 0;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
var rawVers = typeof(Program).Assembly.GetName().Version; ;
|
||||
await Task.Delay(1);
|
||||
var rawVers = typeof(Program).Assembly.GetName().Version;
|
||||
version = rawVers != null ? rawVers : new Version("0.0.0.0");
|
||||
StartTimer();
|
||||
dtTimerScadenzaLogin = SMServ.GetConfInt("TAB_dtTimerScadLogin");
|
||||
if (dtTimerScadenzaLogin > 0)
|
||||
{
|
||||
StartTimer();
|
||||
}
|
||||
|
||||
}
|
||||
//protected override void OnInitialized()
|
||||
//{
|
||||
|
||||
//}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>6.16.2311.2916</Version>
|
||||
<Version>6.16.2311.3010</Version>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP_TAB_SERV</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2311.2916</h4>
|
||||
<h4>Versione: 6.16.2311.3010</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2311.2916
|
||||
6.16.2311.3010
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2311.2916</version>
|
||||
<version>6.16.2311.3010</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/MP-TAB-SERV.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
|
||||
<PageTitle>MP-TAB-SERV</PageTitle>
|
||||
|
||||
<div class="page">
|
||||
|
||||
<div class="page" @onclick="()=>handleBodyClick()">
|
||||
<main>
|
||||
<CmpTop CurrMenuItems="@CurrMenuItems"></CmpTop>
|
||||
<article class="content pt-1 d-flex mb-5">
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using global::Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Routing;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.Data.Services;
|
||||
using NLog;
|
||||
@@ -55,6 +56,9 @@ namespace MP_TAB_SERV.Shared
|
||||
[Inject]
|
||||
protected TabDataService TDataService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
@@ -65,6 +69,12 @@ namespace MP_TAB_SERV.Shared
|
||||
}
|
||||
|
||||
|
||||
protected async Task handleBodyClick()
|
||||
{
|
||||
await JSRuntime.InvokeVoidAsync("alert", "bodyClicked");
|
||||
MsgServ.dtLastAction = DateTime.Now;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Init struttura dati
|
||||
/// </summary>
|
||||
|
||||
@@ -47,10 +47,38 @@ namespace MP.Data.Services
|
||||
|
||||
public event Action EA_PageUpdated = null!;
|
||||
|
||||
public event Action EA_ResetFooterTimer = null!;
|
||||
|
||||
#endregion Public Events
|
||||
|
||||
#region Public Properties
|
||||
|
||||
#if false
|
||||
protected bool _tReset { get; set; } = false;
|
||||
protected bool tReset
|
||||
{
|
||||
get => _tReset;
|
||||
set
|
||||
{
|
||||
if (_tReset != value)
|
||||
{
|
||||
_tReset = value;
|
||||
resetTimer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void resetTimer()
|
||||
{
|
||||
if (EA_ResetFooterTimer != null)
|
||||
{
|
||||
EA_ResetFooterTimer?.Invoke();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
public DateTime dtLastAction { get; set; } = DateTime.Now;
|
||||
|
||||
public string CognomeNome
|
||||
{
|
||||
get
|
||||
|
||||
Reference in New Issue
Block a user