ChannelPrsnt.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. using Uestc.Auto6.Dso.Core.Tools;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Drawing;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading;
  8. using System.Threading.Tasks;
  9. using Uestc.Auto6.Dso.ComModel;
  10. namespace Uestc.Auto6.Dso.Core
  11. {
  12. public abstract class ChannelPrsnt : MulticastPrsnt<IChnlView>, IChnlPrsnt
  13. {
  14. private protected abstract override ChannelModel Model
  15. {
  16. get;
  17. }
  18. public ChannelPrsnt(IChnlView? view)
  19. {
  20. if (view != null)
  21. {
  22. //建立起View和Presenter的关联
  23. //这时候View中能使用它所对应的Presenter进行业务逻辑的操作
  24. view.Presenter = this;
  25. //通过构造函数将View注入到Presenter中
  26. TryAddView(view);
  27. }
  28. }
  29. public ChannelType Type => Model.Type;
  30. public ChannelId Id => Model.Id;
  31. public String Name => Model.Name;
  32. public Color DrawColor
  33. {
  34. get => Model.DrawColor;
  35. set => Model.DrawColor = value;
  36. }
  37. public virtual Boolean Active
  38. {
  39. get => Model.Active;
  40. set => Model.Active = value;
  41. }
  42. public String Label
  43. {
  44. get => Model.Label;
  45. set => Model.Label = value;
  46. }
  47. public abstract ISampling Sampling
  48. {
  49. get;
  50. }
  51. //Default stride is 1000/div, so its name suffix "BymDiv", but the corresponding model name does not.
  52. public virtual Double PosIndexBymDiv
  53. {
  54. get => Model.Conditioning.PosIndex;
  55. set
  56. {
  57. Model.Conditioning.PosIndex = value;
  58. Dispatcher.SoftReset();
  59. }
  60. }
  61. public Double PosMaxIndex => Model.Conditioning.PosMaxIndex;
  62. public Double PosMinIndex => Model.Conditioning.PosMinIndex;
  63. public virtual void ResetPosIndex()
  64. {
  65. Model.Conditioning.PosIndex = Model.Conditioning.PosDefIndex;
  66. Dispatcher.SoftReset();
  67. }
  68. public Double PosIdxPerDiv => Model.Conditioning.PosIdxPerDiv;
  69. /// <summary>
  70. /// Adjust 'ScaleIndex' to roughly change vertical scale.
  71. /// </summary>
  72. public virtual Int32 ScaleIndex
  73. {
  74. get => Model.Conditioning.ScaleIndex;
  75. set
  76. {
  77. Model.Conditioning.ScaleIndex = value;
  78. Dispatcher.SoftReset();
  79. }
  80. }
  81. //public Double ScaleMaxIndex => Model.Conditioning.ScaleMaxIndex;
  82. //public Double ScaleMinIndex => Model.Conditioning.ScaleMinIndex;
  83. /// <summary>
  84. /// Adjust 'ScaleTick' to finely change vertical scale.
  85. /// </summary>
  86. public virtual Int32 ScaleTick
  87. {
  88. get => Model.Conditioning.ScaleTick;
  89. set
  90. {
  91. Model.Conditioning.ScaleTick = value;
  92. Dispatcher.SoftReset();
  93. }
  94. }
  95. public String Unit
  96. {
  97. get => Model.Conditioning.Unit;
  98. set => Model.Conditioning.Unit = value;
  99. }
  100. public Prefix Prefix => Model.Conditioning.Prefix;
  101. public WfmPack? Pack => Model.Pack;
  102. public WfmVuDatabase VuDatabase => Model.VuDatabase;
  103. public Int64? WindowId
  104. {
  105. get => Model.WindowId;
  106. set => Model.WindowId = value;
  107. }
  108. }
  109. }