UI_SequentMicrosystems-RPI/Components/PointsTableRTD8TMComponent....

102 lines
2.5 KiB
Plaintext
Raw Normal View History

@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
<table class="table table-striped text-white">
<thead>
<tr>
<th scope="col">Time</th>
@foreach (byte stack in _RTD8TMService.GetActualData().Keys)
{
for (byte chanel = 0; chanel < 8; chanel++)
{
if (_RTD8TMService.GetChanelName(stack, chanel) != "----------")
{
<th>
@_RTD8TMService.GetChanelName(stack, chanel)
@if (_RTD8TMService.GetValueType(stack, chanel) == RTD8TMSensorTypes.PT100)
{
@Celsius
}
else
{
@Ohm
}
</th>
}
}
}
</tr>
</thead>
<tbody>
@foreach (long time in TableData.Keys)
{
<tr class="text-white @TableBacgroundChanger() ">
<td>@(new DateTime(time).ToString("HH:mm:ss"))</td>
@foreach (byte stack in TableData[time].Keys)
{
for (byte chanel = 0; chanel < 8; chanel++)
{
if (_RTD8TMService.GetChanelName(stack, chanel) != "----------")
{
<td>@(new RTD8TMChanelComponent().RecalculateValues(TableData[time][stack][chanel], _RTD8TMService.GetValueType(stack, chanel)))</td>
}
}
}
</tr>
}
</tbody>
</table>
@code {
private SortedList<long, SortedList<byte,List<float>>> TableData = new();
private string Ohm = " (Ω)";
private string Celsius = " (°C)";
private bool TableBackground = false;
protected override void OnInitialized()
{
TableData = _PointsService.GetPoints().RTD8TM;
}
private string TableBacgroundChanger()
{
if (TableBackground)
{
TableBackground = false;
return "bg-black";
}
else
{
TableBackground = true;
return "bg-dark";
}
}
}