//TODO: Switch this and other color converters to be colorblind friendly? public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { JobScheduleState state = JobScheduleState.Unmapped; if (value != null) { state = (JobScheduleState)value; } switch (state) { case JobScheduleState.Active: return(new SolidColorBrush(Colors.Blue)); case JobScheduleState.Completed: return(new SolidColorBrush(Colors.Green)); case JobScheduleState.Deleting: return(new SolidColorBrush(Colors.Gray)); case JobScheduleState.Disabled: return(new SolidColorBrush(Colors.Gray)); case JobScheduleState.Terminating: return(new SolidColorBrush(Colors.DarkRed)); case JobScheduleState.Invalid: case JobScheduleState.Unmapped: return(new SolidColorBrush(Colors.Gray)); default: throw new ArgumentOutOfRangeException(); } }
internal static string ToSerializedValue(this JobScheduleState value) { switch (value) { case JobScheduleState.Active: return("active"); case JobScheduleState.Completed: return("completed"); case JobScheduleState.Disabled: return("disabled"); case JobScheduleState.Terminating: return("terminating"); case JobScheduleState.Deleting: return("deleting"); } return(null); }
public static string ToSerialString(this JobScheduleState value) => value switch {