PIDShowConverter.cs 863 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Globalization;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows.Data;
  8. using System.Windows.Media;
  9. namespace FurnaceUI.Converter
  10. {
  11. public class PIDShowConverter : IValueConverter
  12. {
  13. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  14. {
  15. if (value is string)
  16. {
  17. if (!((string)value).Contains(",") || ((string)value).Split(',').Length != 3)
  18. {
  19. return value;
  20. }
  21. else
  22. {
  23. var strList = ((string)value).Split(',');
  24. return $"{strList[1]}:{strList[2]}";
  25. }
  26. }
  27. else
  28. return value;
  29. }
  30. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  31. {
  32. throw new NotImplementedException();
  33. }
  34. }
  35. }