Simu_VCEView.xaml.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. using Aitex.Core.RT.IOCore;
  2. using Aitex.Core.UI.MVVM;
  3. using MECF.Framework.Simulator.Core.Commons;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows;
  10. using System.Windows.Controls;
  11. using System.Windows.Data;
  12. using System.Windows.Documents;
  13. using System.Windows.Input;
  14. using System.Windows.Media;
  15. using System.Windows.Media.Imaging;
  16. using System.Windows.Navigation;
  17. using System.Windows.Shapes;
  18. using Venus_Simulator.Devices;
  19. namespace Venus_Simulator.Views
  20. {
  21. /// <summary>
  22. /// Simu_VCEView.xaml 的交互逻辑
  23. /// </summary>
  24. public partial class Simu_VCEView : UserControl
  25. {
  26. public Simu_VCEView()
  27. {
  28. InitializeComponent();
  29. DataContext = new VceViewModel("COM161","VCEA");
  30. }
  31. }
  32. class VceViewModel : SerialPortDeviceViewModel
  33. {
  34. public ICommand CassArrive { get; set; }
  35. public ICommand CassLeave { get; set; }
  36. public ICommand AllExist { get; set; }
  37. public ICommand AllEmpty { get; set; }
  38. public string Title
  39. {
  40. get { return "VCE simulator"; }
  41. }
  42. private VceSimulator _vce;
  43. private string chamber;
  44. public VceViewModel(string port,string _chamber) : base(_chamber)
  45. {
  46. chamber = _chamber;
  47. Init(_vce = new VceSimulator(port));
  48. CassArrive = new DelegateCommand<string>(cassArrive);
  49. CassLeave = new DelegateCommand<string>(cassLeave);
  50. AllExist = new DelegateCommand<string>(allExist);
  51. AllEmpty = new DelegateCommand<string>(allEmpty);
  52. }
  53. private void cassArrive(string obj)
  54. {
  55. IO.DI[$"DETM.DI_{chamber}_Cassette_Present"].Value = true;
  56. }
  57. private void cassLeave(string obj)
  58. {
  59. IO.DI[$"DETM.DI_{chamber.ToString()}_Cassette_Present"].Value = false;
  60. }
  61. private void allExist(string obj)
  62. {
  63. _vce.Wafermap(false);
  64. }
  65. private void allEmpty(string obj)
  66. {
  67. _vce.Wafermap(true);
  68. }
  69. }
  70. }