XRFPMView.xaml.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.ObjectModel;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Data;
  10. using System.Windows.Documents;
  11. using System.Windows.Input;
  12. using System.Windows.Media;
  13. using System.Windows.Media.Imaging;
  14. using System.Windows.Navigation;
  15. using System.Windows.Shapes;
  16. using Aitex.Core.UI.MVVM;
  17. using Aitex.Core.Utilities;
  18. using MECF.Framework.Simulator.Core.Commons;
  19. using MECF.Framework.Simulator.Core.Driver;
  20. using MECF.Framework.Simulator.Core.Robots;
  21. namespace MECF.Framework.Simulator.Core.LoadPorts
  22. {
  23. /// <summary>
  24. /// Dage4300View.xaml 的交互逻辑
  25. /// </summary>
  26. public partial class XRFPMView : UserControl
  27. {
  28. public static readonly DependencyProperty PortProperty = DependencyProperty.Register(
  29. "Port", typeof(int), typeof(TKPMView),
  30. new FrameworkPropertyMetadata(8001, FrameworkPropertyMetadataOptions.AffectsRender));
  31. public int Port
  32. {
  33. get
  34. {
  35. return (int)this.GetValue(PortProperty);
  36. }
  37. set
  38. {
  39. this.SetValue(PortProperty, value);
  40. }
  41. }
  42. public XRFPMView()
  43. {
  44. InitializeComponent();
  45. this.Loaded += OnViewLoaded;
  46. }
  47. private void OnViewLoaded(object sender, RoutedEventArgs e)
  48. {
  49. if (DataContext == null)
  50. {
  51. DataContext = new XRFPMViewModel(Port);
  52. (DataContext as TimerViewModelBase).Start();
  53. }
  54. }
  55. }
  56. class XRFPMViewModel : SocketDeviceViewModel
  57. {
  58. public string Title
  59. {
  60. get { return "XRFPM Simulator"; }
  61. }
  62. public string WaferMap
  63. {
  64. get { return _sim.SlotMap; }
  65. }
  66. public string InfoPadStatus
  67. {
  68. get { return _sim.InforPadState; }
  69. }
  70. [IgnorePropertyChange]
  71. public string InfoPadSet { get; set; }
  72. public ObservableCollection<WaferItem> WaferList { get; set; }
  73. public ICommand PlaceCommand { get; set; }
  74. public ICommand RemoveCommand { get; set; }
  75. public ICommand ClearCommand { get; set; }
  76. public ICommand SetAllCommand { get; set; }
  77. public ICommand RandomCommand { get; set; }
  78. public ICommand SetInfoPadCommand { get; set; }
  79. private XRFPMSimulator _sim;
  80. public XRFPMViewModel(int port) : base("XRFPMViewModel")
  81. {
  82. PlaceCommand = new DelegateCommand<string>(Place);
  83. RemoveCommand = new DelegateCommand<string>(Remove);
  84. ClearCommand = new DelegateCommand<string>(Clear);
  85. SetAllCommand = new DelegateCommand<string>(SetAll);
  86. RandomCommand = new DelegateCommand<string>(RandomGenerateWafer);
  87. SetInfoPadCommand = new DelegateCommand<string>(SetInfoPadStatus);
  88. _sim = new XRFPMSimulator(port);
  89. Init(_sim);
  90. WaferList = new ObservableCollection<WaferItem>()
  91. {
  92. new WaferItem {Display = "1", Index = 2, State = 3}
  93. };
  94. }
  95. private void SetInfoPadStatus(string obj)
  96. {
  97. _sim.InforPadState = InfoPadSet;
  98. }
  99. private void RandomGenerateWafer(string obj)
  100. {
  101. _sim.RandomWafer();
  102. }
  103. private void SetAll(string obj)
  104. {
  105. _sim.SetAllWafer();
  106. }
  107. private void Clear(string obj)
  108. {
  109. _sim.ClearWafer();
  110. }
  111. private void Remove(string obj)
  112. {
  113. _sim.RemoveCarrier();
  114. }
  115. private void Place(string obj)
  116. {
  117. _sim.PlaceCarrier();
  118. }
  119. }
  120. }