ÎļþÃû´Ó WinFrmUI/Yw.WinFrmUI.Hydro.Core/06-parter/03-waterbox/SetHydroWaterboxDlg.cs ÐÞ¸Ä |
| | |
| | | public event Action<List<Yw.Model.HydroWaterboxInfo>> ReloadDataEvent; |
| | | |
| | | //ææé¨ä»¶å表 |
| | | private List<Yw.Model.HydroWaterboxInfo> _allParterList = null; |
| | | private List<Yw.Model.HydroWaterboxInfo> _allVisualList = null; |
| | | |
| | | /// <summary> |
| | | /// ç»å®æ°æ® |
| | | /// </summary> |
| | | public void SetBindingData(Yw.Model.HydroWaterboxInfo parter) |
| | | public void SetBindingData(Yw.Model.HydroWaterboxInfo visual) |
| | | { |
| | | var allParterList = parter == null ? null : new List<Yw.Model.HydroWaterboxInfo>() { parter }; |
| | | SetBindingData(allParterList); |
| | | var allVisualList = visual == null ? null : new List<Yw.Model.HydroWaterboxInfo>() { visual }; |
| | | SetBindingData(allVisualList); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ç»å®æ°æ® |
| | | /// </summary> |
| | | public void SetBindingData(List<Yw.Model.HydroWaterboxInfo> allParterList) |
| | | public void SetBindingData(List<Yw.Model.HydroWaterboxInfo> allVisualList) |
| | | { |
| | | _allParterList = allParterList; |
| | | if (_allParterList != null && _allParterList.Count == 1) |
| | | _allVisualList = allVisualList; |
| | | if (_allVisualList != null && _allVisualList.Count == 1) |
| | | { |
| | | var tank = _allParterList.First(); |
| | | this.txtPoolElev.EditValue = Math.Round(tank.PoolElev, 4); |
| | | this.txtInitLevel.EditValue = Math.Round(tank.InitLevel, 4); |
| | | this.txtMinLevel.EditValue = Math.Round(tank.MinLevel, 4); |
| | | this.txtMaxLevel.EditValue = Math.Round(tank.MaxLevel, 4); |
| | | this.txtDN.EditValue = Math.Round(tank.DN, 4); |
| | | this.ckOverFlow.Checked = tank.OverFlow; |
| | | var visual = _allVisualList.First(); |
| | | this.txtPoolElev.EditValue = Math.Round(visual.PoolElev, 4); |
| | | this.txtInitLevel.EditValue = Math.Round(visual.InitLevel, 4); |
| | | this.txtMinLevel.EditValue = Math.Round(visual.MinLevel, 4); |
| | | this.txtMaxLevel.EditValue = Math.Round(visual.MaxLevel, 4); |
| | | this.txtDN.EditValue = Math.Round(visual.DN, 4); |
| | | this.ckOverFlow.Checked = visual.OverFlow; |
| | | } |
| | | } |
| | | |
| | |
| | | // |
| | | private void btnOk_Click(object sender, EventArgs e) |
| | | { |
| | | if (_allParterList == null || _allParterList.Count < 1) |
| | | if (_allVisualList == null || _allVisualList.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | |
| | | var maxLevel = double.Parse(this.txtMaxLevel.EditValue.ToString()); |
| | | var dn = double.Parse(this.txtDN.EditValue.ToString()); |
| | | var overFlow = this.ckOverFlow.Checked; |
| | | _allParterList.ForEach(x => |
| | | _allVisualList.ForEach(x => |
| | | { |
| | | x.PoolElev = poolElev; |
| | | x.InitLevel = initLevel; |
| | |
| | | x.DN = dn; |
| | | x.OverFlow = overFlow; |
| | | }); |
| | | this.ReloadDataEvent?.Invoke(_allParterList); |
| | | this.ReloadDataEvent?.Invoke(_allVisualList); |
| | | this.DialogResult = DialogResult.OK; |
| | | this.Close(); |
| | | } |