28 lines
785 B
C#
28 lines
785 B
C#
namespace cfs_tracker.Models;
|
|
|
|
public static class HealthStateExtensions
|
|
{
|
|
public static Color ToColor(this HealthState state)
|
|
{
|
|
return state switch
|
|
{
|
|
HealthState.Green => Color.FromArgb("#4CAF50"),
|
|
HealthState.Yellow => Color.FromArgb("#FBC02D"),
|
|
HealthState.Red => Color.FromArgb("#E53935"),
|
|
HealthState.Gray => Color.FromArgb("#757575"),
|
|
_ => Colors.Transparent
|
|
};
|
|
}
|
|
|
|
public static string ToLabel(this HealthState state)
|
|
{
|
|
return state switch
|
|
{
|
|
HealthState.Green => "Gut",
|
|
HealthState.Yellow => "So lala",
|
|
HealthState.Red => "Schlecht",
|
|
HealthState.Gray => "Totalausfall",
|
|
_ => ""
|
|
};
|
|
}
|
|
} |