ÎļþÃû´Ó WinFrmUI/Yw.WinFrmUI.Hydro.Core/06-parter/07-threelink/SetHydroThreelinkDlg.cs ÐÞ¸Ä |
| | |
| | | InitializeComponent(); |
| | | this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon; |
| | | this.layoutControl1.SetupLayoutControl(); |
| | | this.generalOkAndCancelCtrl1.OkEvent += GeneralOkAndCancelCtrl1_OkEvent; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | public event Action<List<Yw.Model.HydroThreelinkInfo>> ReloadDataEvent; |
| | | |
| | | //æææä»¶å表 |
| | | private List<Yw.Model.HydroThreelinkInfo> _allParterList = null; |
| | | private List<Yw.Model.HydroThreelinkInfo> _allVisualList = null; |
| | | |
| | | /// <summary> |
| | | /// ç»å®æ°æ® |
| | | /// </summary> |
| | | public void SetBindingData(Yw.Model.HydroThreelinkInfo parter) |
| | | public void SetBindingData(Yw.Model.HydroThreelinkInfo visual) |
| | | { |
| | | var allParterList = parter == null ? null : new List<Yw.Model.HydroThreelinkInfo>() { parter }; |
| | | SetBindingData(allParterList); |
| | | var allVisualList = visual == null ? null : new List<Yw.Model.HydroThreelinkInfo>() { visual }; |
| | | SetBindingData(allVisualList); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ç»å®æ°æ® |
| | | /// </summary> |
| | | public void SetBindingData(List<Yw.Model.HydroThreelinkInfo> allParterList) |
| | | public void SetBindingData(List<Yw.Model.HydroThreelinkInfo> allVisualList) |
| | | { |
| | | _allParterList = allParterList; |
| | | if (_allParterList != null && _allParterList.Count == 1) |
| | | _allVisualList = allVisualList; |
| | | if (_allVisualList != null && _allVisualList.Count == 1) |
| | | { |
| | | var parter = _allParterList.First(); |
| | | this.txtElev.EditValue = parter.Elev; |
| | | this.txtMinorLoss.EditValue = parter.MinorLoss; |
| | | this.txtMaterial.EditValue = parter.Material; |
| | | this.txtCaliber.EditValue = parter.Caliber; |
| | | this.txtRunningThroughLoss.EditValue = parter.RunningThroughLoss; |
| | | this.txtBranchThroughLoss.EditValue = parter.BranchThroughLoss; |
| | | var visual = _allVisualList.First(); |
| | | this.txtElev.EditValue = visual.Elev; |
| | | this.txtMinorLoss.EditValue = visual.MinorLoss; |
| | | this.txtMaterial.EditValue = visual.Material; |
| | | this.txtCaliber.EditValue = visual.Caliber; |
| | | this.txtRunningThroughLoss.EditValue = visual.RunningThroughLoss; |
| | | this.txtBranchThroughLoss.EditValue = visual.BranchThroughLoss; |
| | | } |
| | | } |
| | | |
| | |
| | | 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? runningThroughLoss = this.txtRunningThroughLoss.EditValue == null ? null : double.Parse(this.txtRunningThroughLoss.EditValue.ToString()); |
| | | double? branchThroughLoss = this.txtBranchThroughLoss.EditValue == null ? null : double.Parse(this.txtBranchThroughLoss.EditValue.ToString()); |
| | | _allParterList.ForEach(x => |
| | | _allVisualList.ForEach(x => |
| | | { |
| | | x.Elev = elev; |
| | | x.MinorLoss = minorLoss; |
| | |
| | | x.RunningThroughLoss = runningThroughLoss; |
| | | x.BranchThroughLoss = branchThroughLoss; |
| | | }); |
| | | this.ReloadDataEvent?.Invoke(_allParterList); |
| | | this.ReloadDataEvent?.Invoke(_allVisualList); |
| | | this.DialogResult = DialogResult.OK; |
| | | this.Close(); |
| | | } |
| | | |
| | | } |
| | | } |