TravelTypeToTextConverter.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. namespace GDNXFD.Alert.Config.Converters
  2. {
  3. using GDNXFD.Alert.Config.Resources.Strings;
  4. using System;
  5. using System.IO;
  6. using System.Windows.Data;
  7. using System.Windows.Media.Imaging;
  8. /// <summary>
  9. /// travel type to text converter
  10. /// </summary>
  11. public class TravelTypeToTextConverter : IValueConverter
  12. {
  13. /// <summary>
  14. /// Convert a travel type to text.
  15. /// </summary>
  16. /// <param name="value"></param>
  17. /// <param name="targetType"></param>
  18. /// <param name="parameter"></param>
  19. /// <param name="culture"></param>
  20. /// <returns></returns>
  21. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  22. {
  23. if (value != null)
  24. {
  25. TravelType travelType = (TravelType)value;
  26. switch (travelType)
  27. {
  28. case TravelType.Unknown:
  29. return StringProvider.GetString("TravelTypeUnkown");
  30. case TravelType.OneWay:
  31. return StringProvider.GetString("TravelTypeOneWay");
  32. case TravelType.Roundtrip:
  33. return StringProvider.GetString("TravelTypeRoundTrip");
  34. default:
  35. break;
  36. }
  37. }
  38. return null;
  39. }
  40. /// <summary>
  41. /// Convert back
  42. /// </summary>
  43. /// <param name="value"></param>
  44. /// <param name="targetType"></param>
  45. /// <param name="parameter"></param>
  46. /// <param name="culture"></param>
  47. /// <returns></returns>
  48. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  49. {
  50. throw new NotImplementedException();
  51. }
  52. }
  53. }