From f1efcbcf48fa6fc7dede2c5c7e91cc953b367fe0 Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期四, 05 十二月 2024 09:58:02 +0800 Subject: [PATCH] 增加匹配应用方法,用于视图 --- WinFrmUI/Yw.WinFrmUI.Hydro.Core/06-visual/09-hydrant/HydroHydrantListCtrl.cs | 99 ++++++++++++++++++++++--------------------------- 1 files changed, 44 insertions(+), 55 deletions(-) diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/06-visual/09-hydrant/HydroHydrantListCtrl.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/06-visual/09-hydrant/HydroHydrantListCtrl.cs index 09a268d..8c25827 100644 --- a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/06-visual/09-hydrant/HydroHydrantListCtrl.cs +++ b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/06-visual/09-hydrant/HydroHydrantListCtrl.cs @@ -10,6 +10,9 @@ this.gridView1.SetNormalView(30); this.gridView1.RegistCustomDrawRowIndicator(40); this.layoutControl1.SetupLayoutControl(); + this.generalSearchAndSetCtrl1.SearchEvent += Search; + this.generalSearchAndSetCtrl1.ClearEvent += Reset; + this.generalSearchAndSetCtrl1.SetEvent += Set; } /// <summary> @@ -30,18 +33,6 @@ public event Action<List<HydroVisualViewModel>> HydroChangedViewEvent; /// <summary> - /// 鏄剧ず鏌ヨ闈㈡澘 - /// </summary> - [Browsable(true)] - [Description("鏄剧ず鏌ヨ闈㈡澘")] - [DefaultValue(true)] - public bool ShowFindPanel - { - get { return this.gridView1.OptionsFind.AlwaysVisible; } - set { this.gridView1.OptionsFind.AlwaysVisible = value; } - } - - /// <summary> /// 鏄惁鎷ユ湁姘村姏鍒楄〃 /// </summary> public bool HasHydroList @@ -59,16 +50,7 @@ /// </summary> public void SetBindingData(Yw.Model.HydroModelInfo hydroInfo) { - _allList = new List<HydroHydrantViewModel>(); - if (hydroInfo != null && hydroInfo.Hydrants != null && hydroInfo.Hydrants.Count > 0) - { - foreach (var visual in hydroInfo.Hydrants) - { - var vm = new HydroHydrantViewModel(visual, hydroInfo); - _allList.Add(vm); - } - } - Search(); + SetBindingData(hydroInfo, allCalcuResultVisualDict: null); } /// <summary> @@ -76,13 +58,22 @@ /// </summary> public void SetBindingData(Yw.Model.HydroModelInfo hydroInfo, List<HydroCalcuVisualResult> allCalcuResultList) { + var allCalcuResultVisualDict = allCalcuResultList?.ToDictionary(x => x.Code); + SetBindingData(hydroInfo, allCalcuResultVisualDict); + } + + /// <summary> + /// 缁戝畾鏁版嵁 + /// </summary> + public void SetBindingData(HydroModelInfo hydroInfo, Dictionary<string, HydroCalcuVisualResult> allCalcuResultVisualDict) + { _allList = new List<HydroHydrantViewModel>(); if (hydroInfo != null && hydroInfo.Hydrants != null && hydroInfo.Hydrants.Count > 0) { foreach (var visual in hydroInfo.Hydrants) { var vm = new HydroHydrantViewModel(visual, hydroInfo); - var calcuResult = allCalcuResultList?.Find(x => x.Code == visual.Code); + var calcuResult = allCalcuResultVisualDict?.GetValue(visual.Code); if (calcuResult != null) { vm.UpdateCalcuProperty(calcuResult); @@ -101,7 +92,7 @@ _allList = new List<HydroHydrantViewModel>(); allVisualViewModelList?.ForEach(x => { - if (x.Catalog == HydroParterCatalogHelper.GetName(Yw.Hydro.ParterCatalog.Hydrant)) + if (x.Vmo.Catalog == Yw.Hydro.ParterCatalog.Hydrant) { _allList.Add(x as HydroHydrantViewModel); } @@ -181,13 +172,22 @@ /// </summary> public void UpdateCalcuProperty(List<HydroCalcuVisualResult> allCalcuResultList) { - if (allCalcuResultList != null && allCalcuResultList.Count > 0) + var allCalcuResultVisualDict = allCalcuResultList?.ToDictionary(x => x.Code); + UpdateCalcuProperty(allCalcuResultVisualDict); + } + + /// <summary> + /// 鏇存柊璁$畻灞炴�� + /// </summary> + public void UpdateCalcuProperty(Dictionary<string, HydroCalcuVisualResult> allCalcuResultVisualDict) + { + if (allCalcuResultVisualDict != null && allCalcuResultVisualDict.Count > 0) { if (_allList != null && _allList.Count > 0) { foreach (var visual in _allList) { - var calcuResult = allCalcuResultList.Find(x => x.Code == visual.Code); + var calcuResult = allCalcuResultVisualDict.GetValue(visual.Code); if (calcuResult != null) { visual.UpdateCalcuProperty(calcuResult); @@ -255,24 +255,6 @@ this.HydroChangedInfoEvent?.Invoke(allVisualInfoList); }; dlg.ShowDialog(); - } - - //鏌ヨ - private void btnSearch_Click(object sender, EventArgs e) - { - Search(); - } - - //閲嶇疆 - private void btnReset_Click(object sender, EventArgs e) - { - Reset(); - } - - //璁剧疆 - private void btnSet_Click(object sender, EventArgs e) - { - Set(); } private void gridView1_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e) @@ -392,19 +374,26 @@ this.colSet.Visible = true; } - public void SetBindingData(HydroModelInfo hydroInfo, Dictionary<string, HydroCalcuVisualResult> allCalcuResultVisualDict) - { - - } - - public void UpdateCalcuProperty(Dictionary<string, HydroCalcuVisualResult> allCalcuResultVisualDict) - { - - } - + /// <summary> + /// 璁剧疆缁撴灉妯″紡 + /// </summary> public void SetResultView() { - + this.groupForHead.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; + this.colDbLocked.Visible = true; + this.colName.Visible = true; + this.colCode.Visible = true; + this.colModelType.Visible = true; + this.colCoefficient.Visible = true; + this.colElev.Visible = true; + this.colMinorLoss.Visible = true; + this.colHasDb.Visible = true; + this.colFlags.Visible = true; + this.colDescription.Visible = true; + this.colCalcuPress.Visible = true; + this.colCalcuHead.Visible = true; + this.colCalcuDemand.Visible = true; + this.colSet.Visible = false; } } } -- Gitblit v1.9.3