From 9ffb31c233f3b4891550293294c2ee716f77b42a Mon Sep 17 00:00:00 2001 From: duheng <2784771470@qq.com> Date: 星期日, 22 九月 2024 19:08:49 +0800 Subject: [PATCH] 完善自动匹配 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/ValveMatchingCtrl.cs | 44 +++++++++++++++++++++++++++++++++++++++----- 1 files changed, 39 insertions(+), 5 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/ValveMatchingCtrl.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/ValveMatchingCtrl.cs index b506264..eb55e2f 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/ValveMatchingCtrl.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/02-AsstesFormCtrl/ValveMatchingCtrl.cs @@ -10,10 +10,29 @@ this.gridView1.OptionsView.ShowGroupPanel = false; } - private List<ValveMatchingViewModel> _allBindingList = null; + private List<ValveFormViewModel> _allBindingList = new List<ValveFormViewModel>(); - public List<ValveMatchingViewModel> SetBindingData(List<ValveMatchingViewModel> inputs, List<ValveMainVmo> alllist) + /// <summary> + /// 鐐瑰嚮浜嬩欢 + /// </summary> + public event Action<string> RowClickEvent; + + public void SetBindingData(List<ValveMatchingViewModel> valveMatchingViewModels) { + if (valveMatchingViewModels != null) + { + foreach (var item in valveMatchingViewModels) + { + _allBindingList.Add(new ValveFormViewModel(item)); + } + this.valveFormViewModelBindingSource.DataSource = _allBindingList; + } + } + + public List<ValveMatchingViewModel> SetMatching(List<ValveMatchingViewModel> inputs, List<ValveMainVmo> alllist) + { + if (inputs == null) + return null; var finishList = new List<ValveMatchingViewModel>(); foreach (var item in inputs) { @@ -24,12 +43,27 @@ } else { + finishList.Add(item); } } - _allBindingList = finishList; - this.valveMatchingViewModelBindingSource.DataSource = _allBindingList; - this.valveMatchingViewModelBindingSource.ResetBindings(false); + _allBindingList.Clear(); + foreach (var item in finishList) + { + _allBindingList.Add(new ValveFormViewModel(item)); + } + this.valveFormViewModelBindingSource.ResetBindings(false); return finishList; } + + //琛岀偣鍑讳簨浠� + private void gridView1_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e) + { + var row = this.gridView1.GetCurrentViewModel(_allBindingList); + if (row == null) + { + return; + } + this.RowClickEvent?.Invoke(row.Code); + } } } \ No newline at end of file -- Gitblit v1.9.3