Files
mapo-mono/MP.MONO.UI/Components/ProgBar.razor.cs
T
2022-06-11 12:42:42 +02:00

60 lines
1.3 KiB
C#

using Microsoft.AspNetCore.Components;
namespace MP.MONO.UI.Components
{
public partial class ProgBar
{
#region Public Properties
[Parameter]
public double currVal { get; set; } = 50;
[Parameter]
public double maxVal { get; set; } = 100;
[Parameter]
public int redLim { get; set; } = 10;
[Parameter]
public int yelLim { get; set; } = 20;
#endregion Public Properties
#region Private Properties
private string bgStyle
{
get => $"bg-{currStyle}";
}
private string textStyle
{
get => $"text-{currStyle}";
}
private string currStyle
{
get
{
string answ = "dark";
if (currVal <= redLim)
{
answ = "danger";
}
else if (currVal <= yelLim)
{
answ = "warning";
}
else
{
answ = "success";
}
return answ;
}
}
private int percWidth { get => (int)(100 * currVal / maxVal); }
#endregion Private Properties
}
}