Files
mapo-mono/MP.MONO.UI/Components/DisplayRecordComponent.razor.cs
2023-04-13 17:45:46 +02:00

45 lines
1.3 KiB
C#

using Microsoft.AspNetCore.Components;
using MP.MONO.Core.DTO;
using System.Diagnostics.Tracing;
namespace MP.MONO.UI.Components
{
public partial class DisplayRecordComponent
{
#region Public Properties
[Parameter]
public DisplayDataDTO? currRecord { get; set; } = null;
[Parameter]
public List<string> SelVal { get; set; } = new List<string>();
#endregion Public Properties
#region Protected Methods
protected string percProgress(double num, double minVal, double maxVal)
{
string answ = "width: 0%;";
double den = (maxVal - minVal) != 0 ? (maxVal - minVal) : 1;
double ratio = ((double)num) / den;
answ = $"width: {ratio:P0};";
return answ;
}
protected string cssLast(string toolName)
{
string answ = SelVal.Contains(toolName) ? "bg-dark text-light" : "";
// se è ultima testo giallo...
if (SelVal != null && SelVal.Count > 0)
{
var ultimo = SelVal.LastOrDefault();
if (ultimo != null && ultimo.Equals(toolName))
{
answ = "bg-dark text-warning";
}
}
return answ;
}
#endregion Protected Methods
}
}