SlotBorderConverter.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using OpenSEMI.Ctrlib.Controls;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows.Data;
  8. namespace OpenSEMI.Ctrlib.Converter
  9. {
  10. internal class SlotBorderConverter : IValueConverter
  11. {
  12. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  13. {
  14. if (value is SlotBorderStatus)
  15. {
  16. //deal with the priority
  17. SlotBorderStatus status = (SlotBorderStatus)value;
  18. if (status.HasFlag(SlotBorderStatus.MouseOver))
  19. return SlotBorderStatus.MouseOver;
  20. else if (status.HasFlag(SlotBorderStatus.TransferSource))
  21. return SlotBorderStatus.TransferSource;
  22. else if (status.HasFlag(SlotBorderStatus.TransferTarget))
  23. return SlotBorderStatus.TransferTarget;
  24. else if (status.HasFlag(SlotBorderStatus.Selected))
  25. return SlotBorderStatus.Selected;
  26. else
  27. return SlotBorderStatus.None;
  28. }
  29. return SlotBorderStatus.None;
  30. }
  31. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  32. {
  33. throw new NotImplementedException();
  34. }
  35. }
  36. }