ErrContentConverter.cs 1010 B

12345678910111213141516171819202122232425262728293031323334
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Windows.Data;
  6. using System.Windows;
  7. using System.Windows.Media;
  8. namespace Aitex.UI.RecipeEditor
  9. {
  10. class ErrContentConverter : IValueConverter
  11. {
  12. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  13. {
  14. try
  15. {
  16. if (value == null) return " Valid";
  17. var errors = value as List<Tuple<int/*row no*/, int/*col no*/, string/*var name*/, string/*reason*/>>;
  18. return string.Format(" {0} Error", errors.Count);
  19. }
  20. catch (Exception ex)
  21. {
  22. System.Diagnostics.Debug.WriteLine(ex.Message);
  23. }
  24. return " Error";
  25. }
  26. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  27. {
  28. return null;
  29. }
  30. }
  31. }