ButterflyValveViewModel.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using MECF.Framework.Common.OperationCenter;
  2. using Prism.Commands;
  3. using Prism.Mvvm;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace Venus_MainPages.ViewModels
  10. {
  11. public class ButterflyValveViewModel : BindableBase
  12. {
  13. #region 私有字段
  14. private string ModuleName = "PMA";
  15. private bool m_IsPositionMode;
  16. private int? m_SetValue;
  17. private int? m_FeedBackValue;
  18. #endregion
  19. #region 属性
  20. public bool IsPositionMode
  21. {
  22. get { return m_IsPositionMode; }
  23. set { SetProperty(ref m_IsPositionMode, value); }
  24. }
  25. public int? SetValue
  26. {
  27. get { return m_SetValue; }
  28. set { SetProperty(ref m_SetValue, value); }
  29. }
  30. public int? FeedBackValue
  31. {
  32. get { return m_FeedBackValue; }
  33. set { SetProperty(ref m_FeedBackValue, value); }
  34. }
  35. #endregion
  36. #region 命令
  37. private DelegateCommand _SetCommand;
  38. public DelegateCommand SetCommand =>
  39. _SetCommand ?? (_SetCommand = new DelegateCommand(OnSet));
  40. #endregion
  41. #region 命令方法
  42. private void OnSet()
  43. {
  44. if (IsPositionMode == true)
  45. {
  46. InvokeClient.Instance.Service.DoOperation($"{ModuleName}.SetPVPostion",SetValue);
  47. }
  48. else
  49. {
  50. InvokeClient.Instance.Service.DoOperation($"{ModuleName}.SetPVPressure",SetValue);
  51. }
  52. }
  53. #endregion
  54. }
  55. }