NumToGoodsIsEnabledConvert.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Windows.Data;
  6. namespace Muchinfo.MTPClient.Infrastructure.Converters
  7. {
  8. public class NumToGoodsIsEnabledConvert : IValueConverter
  9. {
  10. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  11. {
  12. string result = string.Empty;
  13. if (value != null)
  14. {
  15. if ((int)value == 1 || (int)value == 2)
  16. {
  17. return false;
  18. }
  19. else
  20. {
  21. return true;
  22. }
  23. }
  24. return result;
  25. }
  26. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  27. {
  28. throw new NotImplementedException();
  29. }
  30. }
  31. public class NumToGoodsIsCheckedConvert : IValueConverter
  32. {
  33. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  34. {
  35. string result = string.Empty;
  36. if (value != null)
  37. {
  38. if ((int)value == 1 || (int)value == 2)
  39. {
  40. return true;
  41. }
  42. else
  43. {
  44. return false;
  45. }
  46. }
  47. return result;
  48. }
  49. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  50. {
  51. throw new NotImplementedException();
  52. }
  53. }
  54. }