LLStateConverter.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. LLState currentState = (LLState)Enum.Parse(typeof(LLState), value.ToString());
  16. switch (currentState)
  17. {
  18. case LLState.Init:
  19. return new SolidColorBrush(Colors.Yellow);
  20. case LLState.Idle:
  21. return new SolidColorBrush(Colors.WhiteSmoke);
  22. case LLState.Error:
  23. return new SolidColorBrush(Colors.Red);
  24. default:
  25. return new SolidColorBrush(Colors.Lime);
  26. }
  27. }
  28. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  29. {
  30. return null;
  31. }
  32. }
  33. }