1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- using Bolt.Toolkit.Wpf.Data.Enum;
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Data;
- using System.Windows.Media;
- namespace Bolt.Toolkit.Wpf.Converters
- {
- public class WaferColorConverter : IMultiValueConverter
- {
- public Brush IdleWafer { get; set; }
- public Brush BusyWafer { get; set; }
- public Brush WaitWafer { get; set; }
- public Brush CompleteWafer { get; set; }
- public Brush ErrorWafer { get; set; }
- public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
- {
- if (values[0] == null || values[0] == DependencyProperty.UnsetValue)
- return null;
- var status = (WaferStatus)values[0];
- var state = (WaferProcessStatus)values[1];
- switch (status)
- {
- case WaferStatus.Empty:
- return null;
- case WaferStatus.Normal:
- switch (state)
- {
- case WaferProcessStatus.Idle:
- return IdleWafer;
- case WaferProcessStatus.Wait:
- return WaitWafer;
- case WaferProcessStatus.InProcess:
- return BusyWafer;
- case WaferProcessStatus.Completed:
- return CompleteWafer;
- case WaferProcessStatus.Failed:
- return ErrorWafer;
- default:
- break;
- }
- return IdleWafer;
- case WaferStatus.Crossed:
- break;
- case WaferStatus.Double:
- break;
- case WaferStatus.Unknown:
- break;
- case WaferStatus.Dummy:
- return IdleWafer;
- default:
- break;
- }
- return IdleWafer;
- }
- public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- }
|