Simu_EfemView.xaml.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. using System.Windows;
  2. using System.Windows.Controls;
  3. using System.Windows.Input;
  4. using Aitex.Core.UI.MVVM;
  5. using MECF.Framework.Simulator.Core.Commons;
  6. using Virgo_DSimulator.Devices;
  7. namespace Virgo_DSimulator.Views
  8. {
  9. /// <summary>
  10. /// Interaction logic for Simu_EfemView.xaml
  11. /// </summary>
  12. public partial class Simu_EfemView : UserControl
  13. {
  14. public Simu_EfemView()
  15. {
  16. InitializeComponent();
  17. this.DataContext = new EfemSimulatorViewModel();
  18. this.Loaded += OnViewLoaded;
  19. }
  20. private void OnViewLoaded(object sender, RoutedEventArgs e)
  21. {
  22. (DataContext as TimerViewModelBase)?.Start();
  23. }
  24. }
  25. class EfemSimulatorViewModel : SocketDeviceViewModel
  26. {
  27. public string Title
  28. {
  29. get { return "EFEM Simulator"; }
  30. }
  31. public string WaferMap
  32. {
  33. get { return _sim.SlotMap; }
  34. }
  35. private EfemSimulatorServer _sim;
  36. public ICommand PlaceCommand { get; set; }
  37. public ICommand RemoveCommand { get; set; }
  38. public ICommand ClearCommand { get; set; }
  39. public ICommand SetAllCommand { get; set; }
  40. public ICommand RandomCommand { get; set; }
  41. public EfemSimulatorViewModel() : base("EfemSimuViewModel")
  42. {
  43. PlaceCommand = new DelegateCommand<string>(Place);
  44. RemoveCommand = new DelegateCommand<string>(Remove);
  45. ClearCommand = new DelegateCommand<string>(Clear);
  46. SetAllCommand = new DelegateCommand<string>(SetAll);
  47. RandomCommand = new DelegateCommand<string>(RandomGenerateWafer);
  48. _sim = new EfemSimulatorServer();
  49. Init(_sim);
  50. }
  51. private void RandomGenerateWafer(string obj)
  52. {
  53. _sim.RandomWafer();
  54. }
  55. private void SetAll(string obj)
  56. {
  57. _sim.SetAllWafer();
  58. }
  59. private void Clear(string obj)
  60. {
  61. _sim.ClearWafer();
  62. }
  63. private void Remove(string obj)
  64. {
  65. _sim.RemoveCarrier();
  66. }
  67. private void Place(string obj)
  68. {
  69. _sim.PlaceCarrier();
  70. }
  71. }
  72. }