Simu_VCEView.xaml.cs 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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.Configuration;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows;
  11. using System.Windows.Controls;
  12. using System.Windows.Data;
  13. using System.Windows.Documents;
  14. using System.Windows.Input;
  15. using System.Windows.Media;
  16. using System.Windows.Media.Imaging;
  17. using System.Windows.Navigation;
  18. using System.Windows.Shapes;
  19. using Venus_Core;
  20. using Venus_Simulator.Devices;
  21. namespace Venus_Simulator.Views
  22. {
  23. /// <summary>
  24. /// Simu_VCEView.xaml 的交互逻辑
  25. /// </summary>
  26. public partial class Simu_VCEView : UserControl
  27. {
  28. public Simu_VCEView()
  29. {
  30. InitializeComponent();
  31. DataContext = new VceViewModel("COM161","VCEA");
  32. }
  33. }
  34. class VceViewModel : SerialPortDeviceViewModel
  35. {
  36. public ICommand CassArrive { get; set; }
  37. public ICommand CassLeave { get; set; }
  38. public ICommand AllExist { get; set; }
  39. public ICommand AllEmpty { get; set; }
  40. public string Title
  41. {
  42. get { return "VCE simulator"; }
  43. }
  44. private VceSimulator _vce;
  45. private string chamber;
  46. private ConfigType type;
  47. public VceViewModel(string port,string _chamber) : base(_chamber)
  48. {
  49. chamber = _chamber;
  50. Init(_vce = new VceSimulator(port));
  51. CassArrive = new DelegateCommand<string>(cassArrive);
  52. CassLeave = new DelegateCommand<string>(cassLeave);
  53. AllExist = new DelegateCommand<string>(allExist);
  54. AllEmpty = new DelegateCommand<string>(allEmpty);
  55. var section = ConfigurationManager.GetSection("customSettings") as System.Collections.Specialized.NameValueCollection;
  56. type = (ConfigType)Convert.ToInt32(section["SimulatorType"]);
  57. }
  58. private void cassArrive(string obj)
  59. {
  60. if(type == ConfigType.VenusSE)
  61. IO.DI[$"SETM.DI_{chamber}_Cassette_Present"].Value = true;
  62. if (type == ConfigType.VenusDE)
  63. IO.DI[$"DETM.DI_{chamber}_Cassette_Present"].Value = true;
  64. }
  65. private void cassLeave(string obj)
  66. {
  67. if (type == ConfigType.VenusSE)
  68. IO.DI[$"SETM.DI_{chamber.ToString()}_Cassette_Present"].Value = false;
  69. if (type == ConfigType.VenusDE)
  70. IO.DI[$"DETM.DI_{chamber.ToString()}_Cassette_Present"].Value = false;
  71. }
  72. private void allExist(string obj)
  73. {
  74. _vce.Wafermap(false);
  75. }
  76. private void allEmpty(string obj)
  77. {
  78. _vce.Wafermap(true);
  79. }
  80. }
  81. }