WaferColorConverter.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using Bolt.Toolkit.Wpf.Data.Enum;
  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;
  9. using System.Windows.Data;
  10. using System.Windows.Media;
  11. namespace Bolt.Toolkit.Wpf.Converters
  12. {
  13. public class WaferColorConverter : IMultiValueConverter
  14. {
  15. public Brush IdleWafer { get; set; }
  16. public Brush BusyWafer { get; set; }
  17. public Brush WaitWafer { get; set; }
  18. public Brush CompleteWafer { get; set; }
  19. public Brush ErrorWafer { get; set; }
  20. public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
  21. {
  22. if (values[0] == null || values[0] == DependencyProperty.UnsetValue)
  23. return null;
  24. var status = (WaferStatus)values[0];
  25. var state = (WaferProcessStatus)values[1];
  26. switch (status)
  27. {
  28. case WaferStatus.Empty:
  29. return null;
  30. case WaferStatus.Normal:
  31. switch (state)
  32. {
  33. case WaferProcessStatus.Idle:
  34. return IdleWafer;
  35. case WaferProcessStatus.Wait:
  36. return WaitWafer;
  37. case WaferProcessStatus.InProcess:
  38. return BusyWafer;
  39. case WaferProcessStatus.Completed:
  40. return CompleteWafer;
  41. case WaferProcessStatus.Failed:
  42. return ErrorWafer;
  43. default:
  44. break;
  45. }
  46. return IdleWafer;
  47. case WaferStatus.Crossed:
  48. break;
  49. case WaferStatus.Double:
  50. break;
  51. case WaferStatus.Unknown:
  52. break;
  53. case WaferStatus.Dummy:
  54. return IdleWafer;
  55. default:
  56. break;
  57. }
  58. return IdleWafer;
  59. }
  60. public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
  61. {
  62. throw new NotImplementedException();
  63. }
  64. }
  65. }