RelationModeConverter.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using Muchinfo.MTPClient.Data.Enums;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Windows;
  7. using System.Windows.Data;
  8. namespace Muchinfo.MTPClient.Infrastructure.Converters
  9. {
  10. public class RelationModeConverter : IValueConverter
  11. {
  12. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  13. {
  14. Visibility result = Visibility.Collapsed;
  15. if (value != null)
  16. {
  17. switch(value.ToString())
  18. {
  19. case "N":
  20. result = Visibility.Collapsed;
  21. break;
  22. default:
  23. result = Visibility.Visible;
  24. break;
  25. }
  26. }
  27. return result;
  28. }
  29. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  30. {
  31. throw new NotImplementedException();
  32. }
  33. }
  34. public class RelationPModeConverter : IValueConverter
  35. {
  36. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  37. {
  38. Visibility result = Visibility.Collapsed;
  39. if (value != null)
  40. {
  41. switch ((eDeliveryContractLink)value)
  42. {
  43. case eDeliveryContractLink.Normal:
  44. result = Visibility.Collapsed;
  45. break;
  46. default:
  47. result = Visibility.Visible;
  48. break;
  49. }
  50. }
  51. return result;
  52. }
  53. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  54. {
  55. throw new NotImplementedException();
  56. }
  57. }
  58. }