From 2a93efc1e3e5b28b915998ce033abac3a2ca4fdd Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 6 Jun 2024 08:19:29 +0200 Subject: [PATCH] Update calcolo condizioni css --- GWMS.UI/Components/PlantOverview.razor | 4 +-- GWMS.UI/Components/PlantOverview.razor.cs | 36 ++++++++++++++--------- GWMS.UI/GWMS.UI.csproj | 2 +- Resources/ChangeLog.html | 2 +- Resources/VersNum.txt | 2 +- Resources/manifest.xml | 2 +- 6 files changed, 28 insertions(+), 20 deletions(-) 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 { - +
NA
}
@@ -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 @@ net6.0 - 1.0.2406.0519 + 1.0.2406.0608 95c9f021-52d1-4390-a670-5810b7b777b0 true true diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index c741e08..fd4f1e4 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ GWMS - Gas Warehouse Management System -

Versione: 1.0.2406.0519

+

Versione: 1.0.2406.0608


Note di rilascio: