BoolSensorConverter.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 Aitex.Core.RT.Log;
  9. namespace MECF.Framework.UI.Core.Converters
  10. {
  11. public class BoolSensorConverter : IValueConverter
  12. {
  13. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  14. {
  15. return (bool)value ? "LightGreen" : "Gray";
  16. }
  17. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  18. {
  19. return null;
  20. }
  21. }
  22. public class BoolWaterConverter : IValueConverter
  23. {
  24. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  25. {
  26. return (bool)value ? "#5CACEE" : "Transport";
  27. }
  28. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  29. {
  30. return null;
  31. }
  32. }
  33. public class ReserveBoolSensorConverter : IValueConverter
  34. {
  35. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  36. {
  37. return !(bool)value ? "LightGreen" : "Gray";
  38. }
  39. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  40. {
  41. return null;
  42. }
  43. }
  44. }