using Yw.Model; namespace Yw.WinFrmUI { /// /// 管道视图 /// public class HydroPipeViewModel : HydroLinkViewModel { /// /// /// public HydroPipeViewModel() { } /// /// /// public HydroPipeViewModel(Yw.Model.HydroPipeInfo rhs, Yw.Model.HydroModelInfo hydroInfo) : base(rhs, hydroInfo) { this.Material = rhs.Material; this.UpdatePropStatus(nameof(this.Material), rhs, nameof(rhs.Material)); this.Diameter = Math.Round(rhs.Diameter, 0); this.UpdatePropStatus(nameof(this.Diameter), rhs, nameof(rhs.Diameter)); this.Length = Math.Round(rhs.Length, 4); this.UpdatePropStatus(nameof(this.Length), rhs, nameof(rhs.Length)); this.Roughness = rhs.Roughness; this.UpdatePropStatus(nameof(this.Roughness), rhs, nameof(rhs.Roughness)); this.MinorLoss = rhs.MinorLoss; this.UpdatePropStatus(nameof(this.MinorLoss), rhs, nameof(rhs.MinorLoss)); this.Vmo = rhs; } /// /// 管道状态 /// [Category("数据")] [DisplayName("管道状态")] [PropertyOrder(13)] [Browsable(true)] [TypeConverter(typeof(HydroPipeStatusConverter))] public override string LinkStatus { get; set; } /// /// 材料 /// [Category("数据")] [DisplayName("材料")] [PropertyOrder(100)] [Browsable(true)] public string Material { get; set; } /// /// 直径 /// [Category("数据")] [DisplayName("直径")] [PropertyOrder(101)] [DisplayUnit("mm")] [Browsable(true)] public double Diameter { get; set; } /// /// 长度 /// [Category("数据")] [DisplayName("长度")] [PropertyOrder(102)] [DisplayUnit("m")] [Browsable(true)] public double Length { get; set; } /// /// 粗糙系数 /// [Category("数据")] [DisplayName("粗糙系数")] [PropertyOrder(103)] [Browsable(true)] public double Roughness { get; set; } /// /// 局阻系数 /// [Category("数据")] [DisplayName("局阻系数")] [PropertyOrder(104)] [Browsable(true)] public double MinorLoss { get; set; } /// /// /// public new Yw.Model.HydroPipeInfo Vmo { get; set; } /// /// 更新属性 /// public override void Update() { base.Update(); this.Material = this.Vmo.Material; this.UpdatePropStatus(nameof(this.Material), this.Vmo, nameof(this.Vmo.Material)); this.Diameter = this.Vmo.Diameter; this.UpdatePropStatus(nameof(this.Diameter), this.Vmo, nameof(this.Vmo.Diameter)); this.Length = this.Vmo.Length; this.UpdatePropStatus(nameof(this.Length), this.Vmo, nameof(this.Vmo.Length)); this.Roughness = this.Vmo.Roughness; this.UpdatePropStatus(nameof(this.Roughness), this.Vmo, nameof(this.Vmo.Roughness)); this.MinorLoss = this.Vmo.MinorLoss; this.UpdatePropStatus(nameof(this.MinorLoss), this.Vmo, nameof(this.Vmo.MinorLoss)); } } }