Update Planner x autorefresh
This commit is contained in:
@@ -116,6 +116,9 @@ else if (ListTimbr != null)
|
||||
<i class="fas fa-angle-double-right"></i>
|
||||
<input @bind="endHour" style="width: 3em;" type="number" />
|
||||
</div>
|
||||
<div class="py-1 px-2">
|
||||
<span>@lastRefresh.ToString("dddd dd.MM.yyyy HH:mm:ss")</span>
|
||||
</div>
|
||||
<div class="py-1 px-2">
|
||||
@if (clonedRA != null)
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace GPW.CORE.UI.Pages
|
||||
/// modale: vedere qui: https://gist.github.com/conficient/ba98d1662c659e170ec16650acea05c8
|
||||
/// </summary>
|
||||
//[Authorize(Roles = "SuperAdmin, Admin")]
|
||||
public partial class Planner
|
||||
public partial class Planner : IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
@@ -298,6 +298,7 @@ namespace GPW.CORE.UI.Pages
|
||||
await Task.Delay(100);
|
||||
checkHourRange();
|
||||
await Task.Delay(100);
|
||||
lastRefresh = DateTime.Now;
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
@@ -339,10 +340,51 @@ namespace GPW.CORE.UI.Pages
|
||||
DtRifTempRil = dataRif;
|
||||
showTemp = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// TImer per refresh dati
|
||||
/// </summary>
|
||||
protected System.Timers.Timer timer;
|
||||
|
||||
protected DateTime lastRefresh = DateTime.Now;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
// avvio un timer infinito x refresh pagina COMUNQUE ogni 60 sec anche non succedesse nulla...
|
||||
timer = new System.Timers.Timer
|
||||
{
|
||||
Interval = 1000 * 60,
|
||||
AutoReset = true,
|
||||
Enabled = true
|
||||
};
|
||||
timer.Elapsed += async (s, ea) => await TryReload();
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
timer?.Dispose();
|
||||
}
|
||||
|
||||
protected async Task TryReload()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
// effettuo reload SOLO SE no ho editing in corso...
|
||||
if (!modeEdit)
|
||||
{
|
||||
await ReloadData();
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
}
|
||||
|
||||
protected bool modeEdit
|
||||
{
|
||||
get => (currRecord != null || ListTimbr != null || showTemp);
|
||||
//get => (selPeriod || showTemp || currRecord != null || weekStatList != null || ListTimbr != null);
|
||||
}
|
||||
|
||||
protected async Task ReloadPeriodo()
|
||||
{
|
||||
selPeriod = false;
|
||||
showTemp=false;
|
||||
showTemp = false;
|
||||
weekStatList = null;
|
||||
currRecord = null;
|
||||
ListTimbr = null;
|
||||
|
||||
@@ -8,11 +8,10 @@
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<base href="~/" />
|
||||
@*<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />*@
|
||||
<link rel="stylesheet" href="lib/bootstrap/css/bootstrap.min.css" />
|
||||
<link href="css/site.css" rel="stylesheet" />
|
||||
<link href="lib/font-awesome/css/all.css" rel="stylesheet" />
|
||||
<link href="GPW.CORE.UI.styles.css" rel="stylesheet" />
|
||||
<link rel="stylesheet"href="css/site.css" />
|
||||
<link rel="stylesheet"href="lib/font-awesome/css/all.css" />
|
||||
<link rel="stylesheet"href="GPW.CORE.UI.styles.css" />
|
||||
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
|
||||
<component type="typeof(HeadOutlet)" render-mode="ServerPrerendered" />
|
||||
</head>
|
||||
|
||||
Reference in New Issue
Block a user