duheng
2024-12-22 51e66d3bc5ef0fe491800ccdce292a8d58300efa
WinFrmUI/Yw.WinFrmUI.Hydro.Core/04-viewmodel/04-link/01-pipe/01-translation/HydroTranslationViewModel.cs
@@ -3,26 +3,91 @@
    /// <summary>
    /// 过渡件视图
    /// </summary>
    public class HydroTranslationViewModel : HydroPipeViewModel
    public class HydroTranslationViewModel : HydroPipeViewModel, IHydroCalcuTranslationResult
    {
        /// <summary>
        /// 
        /// </summary>
        public HydroTranslationViewModel() : base() { }
        public HydroTranslationViewModel() { }
        /// <summary>
        /// 
        /// </summary>
        public HydroTranslationViewModel(Yw.Model.HydroTranslationInfo rhs, Yw.Model.HydroModelInfo hydroInfo) : base(rhs, hydroInfo)
        {
            this.Vmo = rhs;
            this.StartDiameter = Math.Round(rhs.StartDiameter, 0);
            this.UpdatePropStatus(nameof(this.StartDiameter), rhs, nameof(rhs.StartDiameter));
            this.EndDiameter = Math.Round(rhs.EndDiameter, 0);
            this.UpdatePropStatus(nameof(this.EndDiameter), rhs, nameof(rhs.EndDiameter));
        }
        /// <summary>
        /// 直径
        /// </summary>
        [Category("数据")]
        [Display(Name = "直径(mm)")]
        [DisplayName("直径")]
        [DisplayUnit("mm")]
        [PropertyOrder(2002)]
        [Browsable(false)]
        public override double Diameter { get; set; }
        /// <summary>
        /// 上游直径
        /// </summary>
        [Category("数据")]
        [Display(Name = "上游直径(mm)")]
        [DisplayName("上游直径")]
        [DisplayUnit("mm")]
        [PropertyOrder(3001)]
        [Browsable(true)]
        public double StartDiameter { get; set; }
        /// <summary>
        /// 下游直径
        /// </summary>
        [Category("数据")]
        [Display(Name = "下游直径(mm)")]
        [DisplayName("下游直径")]
        [DisplayUnit("mm")]
        [PropertyOrder(3002)]
        [Browsable(true)]
        public double EndDiameter { get; set; }
        /// <summary>
        /// 
        /// </summary>
        [Browsable(false)]
        public new Yw.Model.HydroTranslationInfo Vmo { get; set; }
        public new Yw.Model.HydroTranslationInfo Vmo
        {
            get { return _vmo as Yw.Model.HydroTranslationInfo; }
            set { _vmo = value; }
        }
        /// <summary>
        /// 更新属性
        /// </summary>
        public override void UpdateProperty()
        {
            base.UpdateProperty();
            this.StartDiameter = this.Vmo.StartDiameter;
            this.UpdatePropStatus(nameof(this.StartDiameter), this.Vmo, nameof(this.Vmo.StartDiameter));
            this.EndDiameter = this.Vmo.EndDiameter;
            this.UpdatePropStatus(nameof(this.EndDiameter), this.Vmo, nameof(this.Vmo.EndDiameter));
        }
        /// <summary>
        ///
        /// </summary>
        public override void UpdateVmoProperty()
        {
            base.UpdateVmoProperty();
            this.Vmo.StartDiameter = this.StartDiameter;
            this.Vmo.UpdatePropStatus(nameof(this.Vmo.StartDiameter), this, nameof(this.StartDiameter));
            this.Vmo.EndDiameter = this.EndDiameter;
            this.Vmo.UpdatePropStatus(nameof(this.Vmo.EndDiameter), this, nameof(this.EndDiameter));
        }
    }
}