LLStateConverter.cs 1.4 KB

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