IoConvert.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using System;
  2. using System.Globalization;
  3. using System.Windows.Data;
  4. namespace EfemDualSimulator.Views.Converters
  5. {
  6. public class DiIndexDisplayConvert : IValueConverter
  7. {
  8. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  9. {
  10. return string.Format("DI-{0}", value == null ? "" : value.ToString());
  11. }
  12. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  13. {
  14. throw new NotImplementedException();
  15. }
  16. }
  17. public class DoIndexDisplayConvert : IValueConverter
  18. {
  19. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  20. {
  21. return string.Format("DO-{0}", value == null ? "" : value.ToString());
  22. }
  23. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  24. {
  25. throw new NotImplementedException();
  26. }
  27. }
  28. public class AiIndexDisplayConvert : IValueConverter
  29. {
  30. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  31. {
  32. return string.Format("AI-{0}", value == null ? "" : value.ToString());
  33. }
  34. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  35. {
  36. throw new NotImplementedException();
  37. }
  38. }
  39. public class AoIndexDisplayConvert : IValueConverter
  40. {
  41. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  42. {
  43. return string.Format("AO-{0}", value == null ? "" : value.ToString());
  44. }
  45. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  46. {
  47. throw new NotImplementedException();
  48. }
  49. }
  50. public class DiValueBackgroundConvert : IValueConverter
  51. {
  52. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  53. {
  54. return (bool)value ? "LightGreen" : "LightGray";
  55. }
  56. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  57. {
  58. throw new NotImplementedException();
  59. }
  60. }
  61. }