SimHipaceTurboPumpView.xaml.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. using Aitex.Core.UI.MVVM;
  2. using Aitex.Core.Utilities;
  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. namespace MECF.Framework.Simulator.Core.Pumps.PfeifferHipace
  19. {
  20. public partial class SimHipaceTurboPumpView : UserControl
  21. {
  22. //public static readonly DependencyProperty PortProperty = DependencyProperty.Register(
  23. // "Port", typeof(string), typeof(SimHipaceTurboPumpView),
  24. // new FrameworkPropertyMetadata("COM11", FrameworkPropertyMetadataOptions.AffectsRender));
  25. //public string Port
  26. //{
  27. // get { return (string) this.GetValue(PortProperty); }
  28. // set { this.SetValue(PortProperty, value); }
  29. //}
  30. public SimHipaceTurboPumpView()
  31. {
  32. InitializeComponent();
  33. DataContext = new SimHipaceTurboPumpViewModel("COM11");
  34. (DataContext as TimerViewModelBase).Start();
  35. this.Loaded += OnViewLoaded;
  36. }
  37. private void OnViewLoaded(object sender, RoutedEventArgs e)
  38. {
  39. if (DataContext == null)
  40. {
  41. }
  42. }
  43. }
  44. class SimHipaceTurboPumpViewModel : SerialPortDeviceViewModel
  45. {
  46. public string Title
  47. {
  48. get { return "Sim Hipace Turbo Pump Simulator"; }
  49. }
  50. private SimHipaceTurboPump _reader;
  51. public bool IsFailed
  52. {
  53. get
  54. {
  55. return _reader.Failed;
  56. }
  57. set
  58. {
  59. _reader.Failed = value;
  60. }
  61. }
  62. public bool IsPumpOn
  63. {
  64. get
  65. {
  66. return _reader.IsPumpOn;
  67. }
  68. set
  69. {
  70. _reader.IsPumpOn = value;
  71. }
  72. }
  73. public bool IsOverTemp
  74. {
  75. get
  76. {
  77. return _reader.IsOverTemp;
  78. }
  79. set
  80. {
  81. _reader.IsOverTemp = value;
  82. }
  83. }
  84. public bool IsAtSpeed
  85. {
  86. get
  87. {
  88. return _reader.IsAtSpeed;
  89. }
  90. set
  91. {
  92. _reader.IsAtSpeed = value;
  93. }
  94. }
  95. //private string _value;
  96. [IgnorePropertyChange]
  97. public string ResultValue
  98. {
  99. get
  100. {
  101. return _reader.ResultValue;
  102. }
  103. set
  104. {
  105. _reader.ResultValue = value;
  106. }
  107. }
  108. public SimHipaceTurboPumpViewModel(string port) : base("SimHipaceTurboPumpViewModel")
  109. {
  110. _reader = new SimHipaceTurboPump(port);
  111. Init(_reader);
  112. }
  113. }
  114. }