AlarmDataConverter.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System.Globalization;
  2. using System.Windows.Data;
  3. namespace ProximaAnalizer.Converter;
  4. public class MFCUnitConverter : IValueConverter
  5. {
  6. public object? Convert(object? value, Type targetType, object parameter, CultureInfo culture)
  7. {
  8. if (value is not float unit)
  9. return value;
  10. return unit switch
  11. {
  12. 0f => "SCCM",
  13. 1f => "SLM",
  14. _ => value
  15. };
  16. }
  17. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  18. {
  19. throw new NotImplementedException();
  20. }
  21. }
  22. public class LeakCheckNameConvert : IValueConverter
  23. {
  24. public object? Convert(object? value, Type targetType, object parameter, CultureInfo culture)
  25. {
  26. if (value is not string s)
  27. return value;
  28. return s.Replace("LeakCheck", string.Empty);
  29. }
  30. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  31. {
  32. throw new NotImplementedException();
  33. }
  34. }