@using System.Text @using UI_SequentMicrosystems.Constants @using UI_SequentMicrosystems.Models @using UI_SequentMicrosystems.Services @using UI_SequentMicrosystems.Components @inject PointsService _PointsService @inject RTD8TMService _RTD8TMService @if (TableData.Keys.Count > 0) { @foreach (byte stack in _RTD8TMService.GetActualData().Keys) { for (byte chanel = 0; chanel < 8; chanel++) { if (_RTD8TMService.GetChanelName(stack, chanel) != "----------") { } } } @foreach (long time in TableData.Keys) { @foreach (byte stack in TableData[time].Keys) { for (byte chanel = 0; chanel < 8; chanel++) { if (_RTD8TMService.GetChanelName(stack, chanel) != "----------") { } } } } @if (LastDataTime != 0 && AfterHalfHour != 0) { @foreach (byte stack in TableData[TableData.Keys.OrderDescending().First()].Keys) { for (byte chanel = 0; chanel < 8; chanel++) { if (_RTD8TMService.GetChanelName(stack, chanel) != "----------") { } } } }
Time @_RTD8TMService.GetChanelName(stack, chanel) @if (_RTD8TMService.GetValueType(stack, chanel) == RTD8TMSensorTypes.PT100) { @Celsius } else { @Ohm }
@(new DateTime(time).ToString("HH:mm:ss"))@(new RTD8TMChanelComponent().RecalculateValues(TableData[time][stack][chanel], _RTD8TMService.GetValueType(stack, chanel)))
30min Change@Math.Round(new RTD8TMChanelComponent().RecalculateValues(TableData[LastDataTime][stack][chanel], _RTD8TMService.GetValueType(stack, chanel)) - new RTD8TMChanelComponent().RecalculateValues(TableData[AfterHalfHour][stack][chanel], _RTD8TMService.GetValueType(stack, chanel)), 2)
} else {

No data

} @code { private SortedList>> TableData = new(); private string Ohm = " (Ω)"; private string Celsius = " (°C)"; private bool TableBackground = false; private long LastDataTime = 0; private long AfterHalfHour = 0; protected override void OnInitialized() { TableData = _PointsService.GetPoints().RTD8TM; _PointsService.EventPointPage += UpdateView; if (TableData.Keys.Count > 1) { HalfHourTime(); } } private string TableBacgroundChanger() { if (TableBackground) { TableBackground = false; return "bg-black"; } else { TableBackground = true; return "bg-dark"; } } private void HalfHourTime() { LastDataTime = TableData.Keys.OrderDescending().First(); long backhalfhour = new DateTime(LastDataTime).AddMinutes(-30).Ticks; AfterHalfHour = TableData.Keys.OrderBy(item => Math.Abs(backhalfhour - item)).First(); } public async Task UpdateView(object? o, bool b) { await InvokeAsync(() => { TableBackground = false; if (TableData.Keys.Count > 1) { HalfHourTime(); } StateHasChanged(); }); } }