using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace DPumpHydr.DesktopDebug.MainWindow { public partial class SectionShapeInfo18Debug : Form { public SectionShapeInfo18Debug() { InitializeComponent(); } DPumpHydr.WinFrmUI.Volute.ViewModel.SectionBundleInfo sectionBundle = null; DPumpHydr.WinFrmUI.Volute.ctrlSectionShapeInfo18 ctrl = null; private void SectionShapeInfo18Debug_Load(object sender, EventArgs e) { ctrl = new DPumpHydr.WinFrmUI.Volute.ctrlSectionShapeInfo18(); ctrl.Name ="ctrlSectionShapeInfo18"; ctrl.Dock = DockStyle.Fill; this.panel1.Controls.Add(ctrl); //基本参数类 DPumpHydr.WinFrmUI.Volute.ViewModel.HdrBaseInfo hdrBase = new DPumpHydr.WinFrmUI.Volute.ViewModel.HdrBaseInfo() { ShapeType = 0, Q = 148, H = 90, n = 2900, D2 = 278, B2 = 15, IsSXB = false, }; //计算转速比 hdrBase.CalcNs(); //基圆参数 DPumpHydr.WinFrmUI.Volute.ViewModel.GeomBaseInfo geomBase = new DPumpHydr.WinFrmUI.Volute.ViewModel.GeomBaseInfo() { D3 = 295, B3 = 30, FAI0 = 32 }; //初始化所有断面参数 sectionBundle = new WinFrmUI.Volute.ViewModel.SectionBundleInfo(); sectionBundle.ResetAllParas(hdrBase, geomBase); #region 传入 DPumpHydr.WinFrmUI.Volute.ViewModel.SectionShapePara sectionShapePara = new DPumpHydr.WinFrmUI.Volute.ViewModel.SectionShapePara(); //从所有断面参数中获取到单个断面的参数 传入第几断面 sectionShapePara = sectionBundle.ToSectionShapePara(1); //传入控件并展示 ctrl.SetBindingData(sectionShapePara); #endregion } private void button1_Click(object sender, EventArgs e) { DPumpHydr.WinFrmUI.Volute.ViewModel.SectionShapePara sectionShapePara = new WinFrmUI.Volute.ViewModel.SectionShapePara(); string error = ""; sectionShapePara = ctrl.GetBindingData(out error); //根据更新后的断面参数 更新总断面参数中对应断面的参数 sectionBundle.FromSectionShapePara(sectionShapePara); if (!string.IsNullOrEmpty(error)) { MessageBox.Show(error); } else { MessageBox.Show("成功获取并更新断面"+sectionShapePara.Index +"参数\r\n高度:" +sectionShapePara.H+" 左圆角半径:" +sectionShapePara.R_Left+" 右圆角半径:" +sectionShapePara.R_Right+" 面积:" +sectionShapePara.SectionArea+" 左gama:" +sectionShapePara.Gama_Left+" 右gama:" +sectionShapePara.Gama_Right); MessageBox.Show("成功更新后的总断面参数\r\n速度系数:"+sectionBundle.K3 +"\r\n平均流速:" + sectionBundle.V3+ "\r\n断面类型:"+sectionBundle.ShapeType.ToString()+ "\r\n外围的半径 :" + sectionBundle.R_out+ "\r\n断面1:" +" 高度:" +sectionBundle.H[1]+" 左圆角半径:" +sectionBundle.R_Left[1]+" 右圆角半径:" +sectionBundle.R_Right[1]+" 面积:" +sectionBundle.Area[1]+" 左gama:" +sectionBundle.GaMa_Left[1]+" 右gama:" +sectionBundle.GaMa_Right[1]+ "\r\n断面2:" +" 高度:" +sectionBundle.H[2]+" 左圆角半径:" +sectionBundle.R_Left[2]+" 右圆角半径:" +sectionBundle.R_Right[2]+" 面积:" +sectionBundle.Area[2]+" 左gama:" +sectionBundle.GaMa_Left[2]+" 右gama:" +sectionBundle.GaMa_Right[2]+ "\r\n断面3:" +" 高度:" +sectionBundle.H[3]+" 左圆角半径:" +sectionBundle.R_Left[3]+" 右圆角半径:" +sectionBundle.R_Right[3]+" 面积:" +sectionBundle.Area[3]+" 左gama:" +sectionBundle.GaMa_Left[3]+" 右gama:" +sectionBundle.GaMa_Right[3]+ "\r\n断面4:" +" 高度:" +sectionBundle.H[4]+" 左圆角半径:" +sectionBundle.R_Left[4]+" 右圆角半径:" +sectionBundle.R_Right[4]+" 面积:" +sectionBundle.Area[4]+" 左gama:" +sectionBundle.GaMa_Left[4]+" 右gama:" +sectionBundle.GaMa_Right[4]+ "\r\n断面5:" +" 高度:" +sectionBundle.H[5]+" 左圆角半径:" +sectionBundle.R_Left[5]+" 右圆角半径:" +sectionBundle.R_Right[5]+" 面积:" +sectionBundle.Area[5]+" 左gama:" +sectionBundle.GaMa_Left[5]+" 右gama:" +sectionBundle.GaMa_Right[5]+ "\r\n断面6:" +" 高度:" +sectionBundle.H[6]+" 左圆角半径:" +sectionBundle.R_Left[6]+" 右圆角半径:" +sectionBundle.R_Right[6]+" 面积:" +sectionBundle.Area[6]+" 左gama:" +sectionBundle.GaMa_Left[6]+" 右gama:" +sectionBundle.GaMa_Right[6]+ "\r\n断面7:" +" 高度:" +sectionBundle.H[7]+" 左圆角半径:" +sectionBundle.R_Left[7]+" 右圆角半径:" +sectionBundle.R_Right[7]+" 面积:" +sectionBundle.Area[7]+" 左gama:" +sectionBundle.GaMa_Left[7]+" 右gama:" +sectionBundle.GaMa_Right[7]+ "\r\n断面8:" +" 高度:" +sectionBundle.H[8]+" 左圆角半径:" +sectionBundle.R_Left[8]+" 右圆角半径:" +sectionBundle.R_Right[8]+" 面积:" +sectionBundle.Area[8]+" 左gama:" +sectionBundle.GaMa_Left[8]+" 右gama:" +sectionBundle.GaMa_Right[8] ); } } } }