LayoutRecipeMonitor2Converter.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using FurnaceUI.Views.Editors;
  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;
  8. using System.Windows.Data;
  9. namespace FurnaceUI.Converter
  10. {
  11. public class LayoutRecipeMonitor2Converter : IValueConverter
  12. {
  13. private static Dictionary<MonitorTransferType, string> keyValuePairs = new Dictionary<MonitorTransferType, string>();
  14. private static void CreateDict()
  15. {
  16. if (keyValuePairs.Count == 0)
  17. {
  18. keyValuePairs.Add(MonitorTransferType.AutoLayout, "Appoint between Carriers");
  19. keyValuePairs.Add(MonitorTransferType.BoatSlot, "Appoint Boat SlotNo.");
  20. keyValuePairs.Add(MonitorTransferType.DirectCarrier, "Appoint between Carriers");
  21. keyValuePairs.Add(MonitorTransferType.AutoCarrier, "Automatic Insert between Carriers");
  22. keyValuePairs.Add(MonitorTransferType.None, "Not Use Monitor Wafer");
  23. }
  24. }
  25. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  26. {
  27. CreateDict();
  28. if (value == null)
  29. return keyValuePairs[MonitorTransferType.AutoLayout];
  30. if (value is LayoutReplacement)
  31. {
  32. return keyValuePairs[(MonitorTransferType)value];
  33. }
  34. return keyValuePairs[MonitorTransferType.AutoLayout];
  35. }
  36. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  37. {
  38. return parameter.ToString();
  39. }
  40. }
  41. }