EFEMStateConverter.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System;
  2. using System.Windows.Data;
  3. using System.Windows.Media;
  4. using Venus_Core;
  5. namespace Venus_MainPages.Converters
  6. {
  7. internal class EFEMStateConverter : IValueConverter
  8. {
  9. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  10. {
  11. if (value == null) return EFEMSTATE.Init;
  12. EFEMSTATE currentState = (EFEMSTATE)Enum.Parse(typeof(EFEMSTATE), value.ToString());
  13. switch (currentState)
  14. {
  15. case EFEMSTATE.Init:
  16. //return new SolidColorBrush(Colors.Yellow);
  17. return new SolidColorBrush((Color)ColorConverter.ConvertFromString("#D79C11"));
  18. case EFEMSTATE.Idle:
  19. return new SolidColorBrush(Colors.WhiteSmoke);
  20. case EFEMSTATE.Error:
  21. return new SolidColorBrush(Colors.Red);
  22. default:
  23. return new SolidColorBrush(Colors.Lime);
  24. }
  25. }
  26. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  27. {
  28. return null;
  29. }
  30. }
  31. }