AITRfSettingDialogViewModel.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. using System.ComponentModel;
  2. using System.Windows.Input;
  3. using Aitex.Core.Common.DeviceData;
  4. using MECF.Framework.Common.OperationCenter;
  5. using MECF.Framework.UI.Client.CenterViews.Editors;
  6. using OpenSEMI.ClientBase;
  7. namespace MECF.Framework.UI.Client.Ctrlib.UnitControls
  8. {
  9. public class AITRfSettingDialogViewModel : DialogViewModel<string>, INotifyPropertyChanged
  10. {
  11. public AITRfSettingDialogViewModel(string dialogName = "")
  12. {
  13. this.DisplayName = dialogName;
  14. }
  15. private AITRfData _data;
  16. public AITRfData DeviceData
  17. {
  18. get
  19. {
  20. return _data;
  21. }
  22. set
  23. {
  24. _data = value;
  25. NotifyOfPropertyChange(nameof(DeviceData));
  26. }
  27. }
  28. private string _setPoint;
  29. public string InputSetPoint
  30. {
  31. get { return _setPoint; }
  32. set
  33. {
  34. _setPoint = value;
  35. NotifyOfPropertyChange(nameof(InputSetPoint));
  36. }
  37. }
  38. private bool _enableOk;
  39. public bool IsEnableOk
  40. {
  41. get
  42. {
  43. return _enableOk;
  44. }
  45. set
  46. {
  47. _enableOk = value;
  48. NotifyOfPropertyChange(nameof(IsEnableOk));
  49. }
  50. }
  51. public bool IsEnablePowerOn
  52. {
  53. get
  54. {
  55. return DeviceData != null && !DeviceData.IsRfOn;
  56. }
  57. }
  58. public bool IsEnablePowerOff
  59. {
  60. get
  61. {
  62. return DeviceData != null && DeviceData.IsRfOn;
  63. }
  64. }
  65. public void Cancel()
  66. {
  67. IsCancel = true;
  68. TryClose(false);
  69. }
  70. protected override void OnViewLoaded(object view)
  71. {
  72. base.OnViewLoaded(view);
  73. }
  74. public void SetPower()
  75. {
  76. InvokeClient.Instance.Service.DoOperation($"{DeviceData.Module}.{DeviceData.DeviceName}.{AITRfOperation.SetPower}", InputSetPoint);
  77. }
  78. public void SetPowerOn()
  79. {
  80. InvokeClient.Instance.Service.DoOperation($"{DeviceData.Module}.{DeviceData.DeviceName}.{AITRfOperation.SetPowerOnOff}", "true");
  81. }
  82. public void SetPowerOff()
  83. {
  84. InvokeClient.Instance.Service.DoOperation($"{DeviceData.Module}.{DeviceData.DeviceName}.{AITRfOperation.SetPowerOnOff}", "false");
  85. }
  86. }
  87. }