JugetoBrushConvert.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. using LogoForceTestApp.Modules.MainModule.Enums;
  2. using System;
  3. using System.Globalization;
  4. using System.Windows.Data;
  5. using System.Windows.Media;
  6. namespace LogoForceTestApp
  7. {
  8. internal class JugetoBrushConvert : IValueConverter
  9. {
  10. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  11. {
  12. if (value is RunResultState juge)
  13. {
  14. var brush = juge switch
  15. {
  16. RunResultState.NG => Brushes.Red,
  17. RunResultState.OK => Brushes.Green,
  18. RunResultState.NOTDEFINED => Brushes.Yellow,
  19. _ => throw new NotImplementedException()
  20. };
  21. return brush;
  22. }
  23. return Brushes.Yellow;
  24. }
  25. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  26. {
  27. throw new NotImplementedException();
  28. }
  29. }
  30. }