IndicatorStateToBoolConverter.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using Aitex.Sorter.Common;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Globalization;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows.Data;
  9. namespace Aitex.Sorter.UI.Converter
  10. {
  11. public class IndicatorStateToBoolConverter : IValueConverter
  12. {
  13. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  14. {
  15. var indicatorState = (IndicatorState)value;
  16. switch (indicatorState)
  17. {
  18. case IndicatorState.UNKNOW:
  19. return false;
  20. case IndicatorState.ON:
  21. return true;
  22. case IndicatorState.BLINK:
  23. return true;
  24. case IndicatorState.OFF:
  25. return false;
  26. default:
  27. return false;
  28. }
  29. }
  30. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  31. {
  32. throw new NotImplementedException();
  33. }
  34. }
  35. }