SimMksPlasmaGeneratorView.xaml.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. using System;
  2. using System.ComponentModel;
  3. using System.Windows;
  4. using System.Windows.Controls;
  5. using Aitex.Core.UI.MVVM;
  6. using Aitex.Core.Utilities;
  7. using MECF.Framework.Simulator.Core.Commons;
  8. namespace MECF.Framework.Simulator.Core.RFs
  9. {
  10. /// <summary>
  11. /// SimMksPlasmaGeneratorView.xaml 的交互逻辑
  12. /// </summary>
  13. public partial class SimMksPlasmaGeneratorView : UserControl
  14. {
  15. SimMksPlasmaGeneratorViewModel _viewModel = null;
  16. //public static readonly DependencyProperty PortProperty = DependencyProperty.Register(
  17. // "Port", typeof(string), typeof(SimMksPlasmaGeneratorView),
  18. // new FrameworkPropertyMetadata("COM1", FrameworkPropertyMetadataOptions.AffectsRender));
  19. //public string Port
  20. //{
  21. // get
  22. // {
  23. // return (string)this.GetValue(PortProperty);
  24. // }
  25. // set
  26. // {
  27. // this.SetValue(PortProperty, value);
  28. // }
  29. //}
  30. public void Initialize(string name, string port)
  31. {
  32. _viewModel = new SimMksPlasmaGeneratorViewModel(port);
  33. this.DataContext = _viewModel;
  34. (DataContext as TimerViewModelBase).Start();
  35. this.Loaded += OnViewLoaded;
  36. }
  37. public SimMksPlasmaGeneratorView()
  38. {
  39. InitializeComponent();
  40. this.Loaded += OnViewLoaded;
  41. }
  42. private void OnViewLoaded(object sender, RoutedEventArgs e)
  43. {
  44. if (DesignerProperties.GetIsInDesignMode(this))
  45. return;
  46. }
  47. }
  48. class SimMksPlasmaGeneratorViewModel : SerialPortDeviceViewModel
  49. {
  50. public string Title
  51. {
  52. get { return "Mks RF Plasma Generator Simulator"; }
  53. }
  54. private SimMksRfPlasmaGenerator _sim;
  55. public bool IsFailed
  56. {
  57. get
  58. {
  59. return _sim.Failed;
  60. }
  61. set
  62. {
  63. _sim.Failed = value;
  64. }
  65. }
  66. public bool IsHalo
  67. {
  68. get
  69. {
  70. return _sim.IsHalo;
  71. }
  72. set
  73. {
  74. _sim.IsHalo = value;
  75. }
  76. }
  77. public bool IsOn
  78. {
  79. get
  80. {
  81. return _sim.IsOn;
  82. }
  83. set
  84. {
  85. _sim.IsOn = value;
  86. }
  87. }
  88. public bool IsContinueAck
  89. {
  90. get
  91. {
  92. return _sim.IsContinueAck;
  93. }
  94. set
  95. {
  96. _sim.IsContinueAck = value;
  97. }
  98. }
  99. ////private string _value;
  100. //[IgnorePropertyChange]
  101. //public string ResultValue
  102. //{
  103. // get
  104. // {
  105. // return _sim.ResultValue;
  106. // }
  107. // set
  108. // {
  109. // _sim.ResultValue = value;
  110. // }
  111. //}
  112. public SimMksPlasmaGeneratorViewModel(string port) : base("SimMksPlasmaGeneratorViewModel")
  113. {
  114. _sim = new SimMksRfPlasmaGenerator(port);
  115. Init(_sim);
  116. }
  117. }
  118. }