ÎļþÃû´Ó WinFrmUI/Yw.WinFrmUI.Hydro.Core/06-parter/04-junction/SetHydroJunctionDlg.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.HydroJunctionInfo>> ReloadDataEvent; |
| | | |
| | | //æææä»¶å表 |
| | | private List<Yw.Model.HydroJunctionInfo> _allParterList = null; |
| | | private List<Yw.Model.HydroJunctionInfo> _allVisualList = null; |
| | | |
| | | /// <summary> |
| | | /// ç»å®æ°æ® |
| | | /// </summary> |
| | | public void SetBindingData(Yw.Model.HydroJunctionInfo parter) |
| | | public void SetBindingData(Yw.Model.HydroJunctionInfo visual) |
| | | { |
| | | var allParterList = parter == null ? null : new List<Model.HydroJunctionInfo>() { parter }; |
| | | SetBindingData(allParterList); |
| | | var allVisualList = visual == null ? null : new List<Model.HydroJunctionInfo>() { visual }; |
| | | SetBindingData(allVisualList); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ç»å®æ°æ® |
| | | /// </summary> |
| | | public void SetBindingData(List<Yw.Model.HydroJunctionInfo> allParterList) |
| | | public void SetBindingData(List<Yw.Model.HydroJunctionInfo> allVisualList) |
| | | { |
| | | _allParterList = allParterList; |
| | | if (_allParterList != null && _allParterList.Count == 1) |
| | | _allVisualList = allVisualList; |
| | | if (_allVisualList != null && _allVisualList.Count == 1) |
| | | { |
| | | var parter = _allParterList.First(); |
| | | this.txtElev.EditValue = Math.Round(parter.Elev, 4); |
| | | this.txtMinorLoss.EditValue = parter.MinorLoss; |
| | | var visual = _allVisualList.First(); |
| | | this.txtElev.EditValue = Math.Round(visual.Elev, 4); |
| | | 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; |
| | | } |
| | |
| | | } |
| | | var elev = double.Parse(this.txtElev.EditValue.ToString()); |
| | | double? minorLoss = this.txtMinorLoss.EditValue == null ? null : double.Parse(this.txtMinorLoss.EditValue.ToString()); |
| | | _allParterList.ForEach(x => |
| | | _allVisualList.ForEach(x => |
| | | { |
| | | x.Elev = elev; |
| | | x.MinorLoss = minorLoss; |
| | | }); |
| | | this.ReloadDataEvent?.Invoke(_allParterList); |
| | | this.ReloadDataEvent?.Invoke(_allVisualList); |
| | | this.DialogResult = DialogResult.OK; |
| | | this.Close(); |
| | | } |
| | | |
| | | } |
| | | } |