WaferColorConverter.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. using Aitex.Core.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;
  9. using System.Windows.Data;
  10. using System.Windows.Media;
  11. namespace EfemDualUI.Converter
  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 = (EnumWaferProcessStatus)values[1];
  26. var isDestination = (bool)values[2];
  27. var isSource = (bool)values[3];
  28. switch (status)
  29. {
  30. case WaferStatus.Empty:
  31. if (isDestination)
  32. {
  33. return BusyWafer;
  34. }
  35. return null;
  36. case WaferStatus.Normal:
  37. switch (state)
  38. {
  39. case EnumWaferProcessStatus.Idle:
  40. return IdleWafer;
  41. //case EnumWaferProcessStatus.Wait:
  42. // return WaitWafer;
  43. case EnumWaferProcessStatus.InProcess:
  44. return BusyWafer;
  45. case EnumWaferProcessStatus.Completed:
  46. return CompleteWafer;
  47. case EnumWaferProcessStatus.Failed:
  48. return ErrorWafer;
  49. default:
  50. break;
  51. }
  52. return IdleWafer;
  53. case WaferStatus.Crossed:
  54. break;
  55. case WaferStatus.Double:
  56. break;
  57. case WaferStatus.Unknown:
  58. break;
  59. case WaferStatus.Dummy:
  60. if (isSource)
  61. {
  62. return WaitWafer;
  63. }
  64. return IdleWafer;
  65. default:
  66. break;
  67. }
  68. return IdleWafer;
  69. }
  70. public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
  71. {
  72. throw new NotImplementedException();
  73. }
  74. }
  75. }