ÎļþÃû´Ó WinFrmUI/Yw.WinFrmUI.Hydro.Core/06-parter/06-elbow/SetHydroElbowDlg.cs ÐÞ¸Ä |
| | |
| | | InitializeComponent(); |
| | | this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon; |
| | | this.layoutControl1.SetupLayoutControl(); |
| | | this.generalOkAndCancelCtrl1.OkEvent += GeneralOkAndCancelCtrl1_OkEvent; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è¿åæ°æ®äºä»¶ |
| | | /// éè½½æ°æ®äºä»¶ |
| | | /// </summary> |
| | | public event Action<List<Yw.Model.HydroElbowInfo>> ReloadDataEvent; |
| | | |
| | | //æææä»¶å表 |
| | | |
| | | private List<Yw.Model.HydroElbowInfo> _allParterList = null; |
| | | private List<Yw.Model.HydroElbowInfo> _allVisualList = null; |
| | | |
| | | /// <summary> |
| | | /// ç»å®æ°æ® |
| | | /// </summary> |
| | | public void SetBindingData(Yw.Model.HydroElbowInfo parter) |
| | | public void SetBindingData(Yw.Model.HydroElbowInfo visual) |
| | | { |
| | | var allParterLit = parter == null ? null : new List<Yw.Model.HydroElbowInfo>() { parter }; |
| | | SetBindingData(allParterLit); |
| | | var allVisualList = visual == null ? null : new List<Yw.Model.HydroElbowInfo>() { visual }; |
| | | SetBindingData(allVisualList); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ç»å®æ°æ® |
| | | /// </summary> |
| | | public void SetBindingData(List<Yw.Model.HydroElbowInfo> allParterList) |
| | | public void SetBindingData(List<Yw.Model.HydroElbowInfo> allVisualList) |
| | | { |
| | | _allParterList = allParterList; |
| | | if (_allParterList != null && _allParterList.Count == 1) |
| | | _allVisualList = allVisualList; |
| | | if (_allVisualList != null && _allVisualList.Count == 1) |
| | | { |
| | | var parter = _allParterList.First(); |
| | | this.txtMaterial.EditValue = parter.Material; |
| | | this.txtCaliber.EditValue = parter.Caliber; |
| | | this.txtBendingAngle.EditValue = parter.BendingAngle; |
| | | this.txtElbowType.EditValue = parter.ElbowType; |
| | | this.txtElev.EditValue = parter.Elev; |
| | | this.txtMinorLoss.EditValue = parter.MinorLoss; |
| | | var visual = _allVisualList.First(); |
| | | this.txtMaterial.EditValue = visual.Material; |
| | | this.txtCaliber.EditValue = visual.Caliber; |
| | | this.txtBendingAngle.EditValue = visual.BendingAngle; |
| | | this.txtElbowType.EditValue = visual.ElbowType; |
| | | this.txtElev.EditValue = visual.Elev; |
| | | this.txtMinorLoss.EditValue = visual.MinorLoss; |
| | | } |
| | | } |
| | | |
| | |
| | | return true; |
| | | } |
| | | |
| | | // |
| | | private void btnOk_Click(object sender, EventArgs e) |
| | | //ç¡®å® |
| | | private void GeneralOkAndCancelCtrl1_OkEvent() |
| | | { |
| | | if (_allParterList == null || _allParterList.Count < 1) |
| | | if (_allVisualList == null || _allVisualList.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | |
| | | double? caliber = this.txtCaliber.EditValue == null ? null : double.Parse(this.txtCaliber.EditValue.ToString()); |
| | | double? blendingAngle = this.txtBendingAngle.EditValue == null ? null : double.Parse(this.txtBendingAngle.EditValue.ToString()); |
| | | var elbowType = this.txtElbowType.Text.Trim(); |
| | | _allParterList.ForEach(x => |
| | | _allVisualList.ForEach(x => |
| | | { |
| | | x.Elev = elev; |
| | | x.MinorLoss = minorLoss; |
| | |
| | | x.BendingAngle = blendingAngle; |
| | | x.ElbowType = elbowType; |
| | | }); |
| | | this.ReloadDataEvent?.Invoke(_allParterList); |
| | | this.ReloadDataEvent?.Invoke(_allVisualList); |
| | | this.DialogResult = DialogResult.OK; |
| | | this.Close(); |
| | | } |
| | | |
| | | } |
| | | } |