First version
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
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",
|
||||
_ => ""
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user