RecipeHeadStringConverter.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  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 RecipeHeadStringConverter : 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 " (Empty)";
  17. var recipeHead = value as RecipeHead;
  18. if (recipeHead == null) return " (Empty)";
  19. return string.Format("Recipe Version:{0}\r\n\r\nLast Modified By:{2}\r\nLast Modified Time:{3}\r\nDescription:{1}",
  20. recipeHead.RecipeVariation, recipeHead.Description, /*recipeHead.CreationTime, recipeHead.CreatedBy, */recipeHead.LastModifiedBy, recipeHead.LastRevisionTime);
  21. }
  22. catch (Exception ex)
  23. {
  24. System.Diagnostics.Debug.WriteLine(ex.Message);
  25. }
  26. return " (Empty)";
  27. }
  28. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  29. {
  30. return null;
  31. }
  32. }
  33. }