using Uestc.Auto6.Dso.Core.Tools; using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using Uestc.Auto6.Dso.ComModel; namespace Uestc.Auto6.Dso.Core { public abstract class ChannelPrsnt : MulticastPrsnt, IChnlPrsnt { private protected abstract override ChannelModel Model { get; } public ChannelPrsnt(IChnlView? view) { if (view != null) { //建立起View和Presenter的关联 //这时候View中能使用它所对应的Presenter进行业务逻辑的操作 view.Presenter = this; //通过构造函数将View注入到Presenter中 TryAddView(view); } } public ChannelType Type => Model.Type; public ChannelId Id => Model.Id; public String Name => Model.Name; public Color DrawColor { get => Model.DrawColor; set => Model.DrawColor = value; } public virtual Boolean Active { get => Model.Active; set => Model.Active = value; } public String Label { get => Model.Label; set => Model.Label = value; } public abstract ISampling Sampling { get; } //Default stride is 1000/div, so its name suffix "BymDiv", but the corresponding model name does not. public virtual Double PosIndexBymDiv { get => Model.Conditioning.PosIndex; set { Model.Conditioning.PosIndex = value; Dispatcher.SoftReset(); } } public Double PosMaxIndex => Model.Conditioning.PosMaxIndex; public Double PosMinIndex => Model.Conditioning.PosMinIndex; public virtual void ResetPosIndex() { Model.Conditioning.PosIndex = Model.Conditioning.PosDefIndex; Dispatcher.SoftReset(); } public Double PosIdxPerDiv => Model.Conditioning.PosIdxPerDiv; /// /// Adjust 'ScaleIndex' to roughly change vertical scale. /// public virtual Int32 ScaleIndex { get => Model.Conditioning.ScaleIndex; set { Model.Conditioning.ScaleIndex = value; Dispatcher.SoftReset(); } } //public Double ScaleMaxIndex => Model.Conditioning.ScaleMaxIndex; //public Double ScaleMinIndex => Model.Conditioning.ScaleMinIndex; /// /// Adjust 'ScaleTick' to finely change vertical scale. /// public virtual Int32 ScaleTick { get => Model.Conditioning.ScaleTick; set { Model.Conditioning.ScaleTick = value; Dispatcher.SoftReset(); } } public String Unit { get => Model.Conditioning.Unit; set => Model.Conditioning.Unit = value; } public Prefix Prefix => Model.Conditioning.Prefix; public WfmPack? Pack => Model.Pack; public WfmVuDatabase VuDatabase => Model.VuDatabase; public Int64? WindowId { get => Model.WindowId; set => Model.WindowId = value; } } }