namespace Yw.WinFrmUI { /// /// 阀门视图 /// public class HydroValveViewModel : HydroLinkViewModel { /// /// /// public HydroValveViewModel() { } /// /// /// public HydroValveViewModel(Yw.Model.HydroValveInfo rhs, Yw.Model.HydroModelInfo hydroInfo) : base(rhs, hydroInfo) { this.Material = rhs.Material; this.UpdatePropStatus(nameof(this.Material), rhs, nameof(rhs.Material)); this.Diameter = rhs.Diameter; this.UpdatePropStatus(nameof(this.Diameter), rhs, nameof(rhs.Diameter)); this.MinorLoss = rhs.MinorLoss; this.UpdatePropStatus(nameof(this.MinorLoss), rhs, nameof(rhs.MinorLoss)); this.ValveType = HydroValveTypeHelper.GetTypeName(rhs.ValveType); this.UpdatePropStatus(nameof(this.ValveType), rhs, nameof(rhs.ValveType)); this.OpeningDegree = rhs.OpeningDegree; this.UpdatePropStatus(nameof(this.OpeningDegree), rhs, nameof(rhs.OpeningDegree)); this.ValveSetting = rhs.ValveSetting; this.UpdatePropStatus(nameof(this.ValveSetting), rhs, nameof(rhs.ValveSetting)); this.Vmo = rhs; } /// /// 阀门状态 /// [Category("数据")] [DisplayName("阀门状态")] [PropertyOrder(1003)] [Browsable(true)] [TypeConverter(typeof(HydroValveStatusConverter))] public override string LinkStatus { get; set; } /// /// 材料 /// [Category("数据")] [DisplayName("材料")] [PropertyOrder(2001)] [Browsable(true)] public string Material { get; set; } /// /// 直径 /// [Category("数据")] [DisplayName("直径")] [PropertyOrder(2002)] [Browsable(true)] [DisplayUnit("mm")] public double Diameter { get; set; } /// /// 局阻系数 /// [Category("数据")] [DisplayName("局阻系数")] [PropertyOrder(2003)] [Browsable(true)] public double MinorLoss { get; set; } /// /// 阀门类型 /// [Category("数据")] [DisplayName("阀门类型")] [PropertyOrder(2004)] [Browsable(true)] [TypeConverter(typeof(HydroValveTypeConverter))] public string ValveType { get; set; } /// /// 阀门开度 /// [Category("数据")] [DisplayName("阀门开度")] [PropertyOrder(2005)] [Browsable(true)] public double OpeningDegree { get; set; } /// /// 阀门设置 /// [Category("数据")] [DisplayName("阀门设置")] [PropertyOrder(2006)] [HydroCurvePro(HydroCurve.ValveQL)] [Browsable(true)] public string ValveSetting { get; set; } /// /// /// [Browsable(false)] public new Yw.Model.HydroValveInfo Vmo { get; set; } /// /// 更新属性 /// public override void UpdateProperty() { base.UpdateProperty(); 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.MinorLoss = this.Vmo.MinorLoss; this.UpdatePropStatus(nameof(this.MinorLoss), this.Vmo, nameof(this.Vmo.MinorLoss)); this.ValveType = HydroValveTypeHelper.GetTypeName(this.Vmo.ValveType); this.UpdatePropStatus(nameof(this.ValveType), this.Vmo, nameof(this.Vmo.ValveType)); this.OpeningDegree = this.Vmo.OpeningDegree; this.UpdatePropStatus(nameof(this.OpeningDegree), this.Vmo, nameof(this.Vmo.OpeningDegree)); this.ValveSetting = this.Vmo.ValveSetting; this.UpdatePropStatus(nameof(this.ValveSetting), this.Vmo, nameof(this.Vmo.ValveSetting)); } /// /// /// public override void UpdateVmoProperty() { base.UpdateVmoProperty(); this.Vmo.Material = this.Material; this.Vmo.UpdatePropStatus(nameof(this.Vmo.Material), this, nameof(this.Material)); this.Vmo.Diameter = this.Diameter; this.Vmo.UpdatePropStatus(nameof(this.Vmo.Diameter), this, nameof(this.Diameter)); this.Vmo.MinorLoss = this.MinorLoss; this.Vmo.UpdatePropStatus(nameof(this.Vmo.MinorLoss), this, nameof(this.MinorLoss)); this.Vmo.ValveType = HydroValveTypeHelper.GetTypeCode(this.ValveType); this.Vmo.UpdatePropStatus(nameof(this.Vmo.ValveType), this, nameof(this.ValveType)); this.Vmo.OpeningDegree = this.OpeningDegree; this.Vmo.UpdatePropStatus(nameof(this.Vmo.OpeningDegree), this, nameof(this.OpeningDegree)); } } }