diff --git a/GWMS.UI/Components/PlantOverview.razor b/GWMS.UI/Components/PlantOverview.razor
index 1a77619..28f776a 100644
--- a/GWMS.UI/Components/PlantOverview.razor
+++ b/GWMS.UI/Components/PlantOverview.razor
@@ -126,7 +126,7 @@
}
else
{
-
+
@@ -147,7 +147,7 @@
}
else
{
-
+
NA
}
diff --git a/GWMS.UI/Components/PlantOverview.razor.cs b/GWMS.UI/Components/PlantOverview.razor.cs
index bab7ea1..5888906 100644
--- a/GWMS.UI/Components/PlantOverview.razor.cs
+++ b/GWMS.UI/Components/PlantOverview.razor.cs
@@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
+using System.Data;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
@@ -15,9 +16,9 @@ namespace GWMS.UI.Components
{
#region Public Properties
- public string checkRTime
+ protected string checkRTime
{
- get => DateTime.Now.Subtract(_currItem.LastUpdate).TotalMinutes > 2 ? $"Mancata ricezione: ultimo aggiornamento {_currItem.LastUpdate}" : $"Dati Realtime aggiornati al {_currItem.LastUpdate}";
+ get => dataIsRT ? $"Dati Realtime aggiornati al {_currItem.LastUpdate}" : $"Mancata ricezione: ultimo aggiornamento {_currItem.LastUpdate}";
}
[Parameter]
@@ -55,29 +56,22 @@ namespace GWMS.UI.Components
}
}
- public string headerStatus
+ protected string headerStatus
{
- get
- {
- string answ = "";
- int TimeoutOffline = 5;
- int.TryParse(Configuration["TimeoutOffline"], out TimeoutOffline);
- answ = DateTime.Now.Subtract(_currItem.LastUpdate).TotalMinutes > TimeoutOffline ? "text-secondary" : "list-group-item-info";
- return answ;
- }
+ get => deviceOnline ? "list-group-item-info" : "text-secondary";
}
- public string playStatus
+ protected string playStatus
{
- get => DateTime.Now.Subtract(_currItem.LastUpdate).TotalMinutes > 2 ? "text-danger" : "text-success";
+ get => dataIsRT ? "text-success" : "text-danger";
}
#endregion Public Properties
#region Public Methods
- public string getPressData(string valore, string formato)
+ protected string getPressData(string valore, string formato)
{
string answ = "";
if (currItem.PressAct.ContainsKey(valore))
@@ -152,9 +146,23 @@ namespace GWMS.UI.Components
protected async Task HandleRedraw()
{
+ checkRt();
fixRedFactor();
await Task.Delay(1);
LevelVal = _currItem.LevelTS.OrderByDescending(x => x.DtEvent).Where((cat, index) => index % redFact == 0).OrderBy(x => x.DtEvent).Select(r => new chartJsData.chartJsTSerie() { x = r.DtEvent, y = r.ValDouble }).ToList();
+ await Task.Delay(1);
+ }
+
+ private bool dataIsRT { get; set; } = false;
+ private bool deviceOnline { get; set; } = false;
+
+ private void checkRt()
+ {
+ DateTime adesso = DateTime.Now;
+ int TimeoutOffline = 5;
+ int.TryParse(Configuration["TimeoutOffline"], out TimeoutOffline);
+ deviceOnline = adesso.Subtract(_currItem.LastUpdate).TotalMinutes <= TimeoutOffline;
+ dataIsRT = adesso.Subtract(_currItem.LastUpdate).TotalMinutes <= 2;
}
protected override async Task OnAfterRenderAsync(bool firstRender)
diff --git a/GWMS.UI/GWMS.UI.csproj b/GWMS.UI/GWMS.UI.csproj
index ab3efcf..cdcbce6 100644
--- a/GWMS.UI/GWMS.UI.csproj
+++ b/GWMS.UI/GWMS.UI.csproj
@@ -2,7 +2,7 @@