AITMicrowaveSettingDialogViewModel.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. using System.ComponentModel;
  2. using System.Windows.Input;
  3. using Aitex.Core.Common.DeviceData;
  4. using DocumentFormat.OpenXml.Presentation;
  5. using MECF.Framework.Common.OperationCenter;
  6. using MECF.Framework.UI.Client.CenterViews.Editors;
  7. using OpenSEMI.ClientBase;
  8. namespace MECF.Framework.UI.Client.Ctrlib.UnitControls
  9. {
  10. public class AITMicrowaveSettingDialogViewModel : DialogViewModel<string>, INotifyPropertyChanged
  11. {
  12. public AITMicrowaveSettingDialogViewModel(string dialogName = "")
  13. {
  14. this.DisplayName = dialogName;
  15. }
  16. private AITRfData _data;
  17. public AITRfData DeviceData
  18. {
  19. get
  20. {
  21. return _data;
  22. }
  23. set
  24. {
  25. _data = value;
  26. NotifyOfPropertyChange(nameof(DeviceData));
  27. }
  28. }
  29. private string _setPoint;
  30. public string InputSetPoint
  31. {
  32. get { return _setPoint; }
  33. set
  34. {
  35. _setPoint = value;
  36. NotifyOfPropertyChange(nameof(InputSetPoint));
  37. }
  38. }
  39. private bool _enableOk;
  40. public bool IsEnableOk
  41. {
  42. get
  43. {
  44. return _enableOk;
  45. }
  46. set
  47. {
  48. _enableOk = value;
  49. NotifyOfPropertyChange(nameof(IsEnableOk));
  50. }
  51. }
  52. public bool IsEnablePowerOn
  53. {
  54. get
  55. {
  56. return DeviceData != null && !DeviceData.IsRfOn;
  57. }
  58. }
  59. public bool IsEnablePowerOff
  60. {
  61. get
  62. {
  63. return DeviceData != null && DeviceData.IsRfOn;
  64. }
  65. }
  66. public bool IsEnableHeatOn
  67. {
  68. get
  69. {
  70. if (DeviceData == null || !DeviceData.AttrValue.ContainsKey("HeatOnSetPoint"))
  71. return false;
  72. return !(bool)DeviceData.AttrValue["HeatOnSetPoint"];
  73. }
  74. }
  75. public bool IsEnableHeatOff
  76. {
  77. get
  78. {
  79. if (DeviceData == null || !DeviceData.AttrValue.ContainsKey("HeatOnSetPoint"))
  80. return false;
  81. return (bool)DeviceData.AttrValue["HeatOnSetPoint"];
  82. }
  83. }
  84. public bool IsHeatOn
  85. {
  86. get
  87. {
  88. if (DeviceData == null || !DeviceData.AttrValue.ContainsKey("HeatOnComplete"))
  89. return false;
  90. return (bool)DeviceData.AttrValue["HeatOnComplete"];
  91. }
  92. }
  93. public void Cancel()
  94. {
  95. IsCancel = true;
  96. TryClose(false);
  97. }
  98. protected override void OnViewLoaded(object view)
  99. {
  100. base.OnViewLoaded(view);
  101. }
  102. public void SetPower()
  103. {
  104. InvokeClient.Instance.Service.DoOperation($"{DeviceData.Module}.{DeviceData.DeviceName}.{AITRfOperation.SetPower}", InputSetPoint);
  105. }
  106. public void SetPowerOn()
  107. {
  108. InvokeClient.Instance.Service.DoOperation($"{DeviceData.Module}.{DeviceData.DeviceName}.{AITRfOperation.SetPowerOnOff}", "true");
  109. }
  110. public void SetPowerOff()
  111. {
  112. InvokeClient.Instance.Service.DoOperation($"{DeviceData.Module}.{DeviceData.DeviceName}.{AITRfOperation.SetPowerOnOff}", "false");
  113. }
  114. public void SetHeatOn()
  115. {
  116. InvokeClient.Instance.Service.DoOperation($"{DeviceData.Module}.{DeviceData.DeviceName}.{AITRfOperation.SetHeatOnOff}", "true");
  117. }
  118. public void SetHeatOff()
  119. {
  120. InvokeClient.Instance.Service.DoOperation($"{DeviceData.Module}.{DeviceData.DeviceName}.{AITRfOperation.SetHeatOnOff}", "false");
  121. }
  122. }
  123. }