using DevExpress.Dialogs.Core.View; namespace HStation.WinFrmUI { public partial class ThreeLinkMatchingCtrl : DevExpress.XtraEditors.XtraUserControl { public ThreeLinkMatchingCtrl() { InitializeComponent(); this.gridView1.SetNormalView(30); this.gridView1.OptionsView.ShowDetailButtons = true; this.gridView1.OptionsView.ShowGroupPanel = false; } private List _allBindingList = new List(); /// /// 点击事件 /// public event Action RowClickEvent; public void SetBindingData(List threeLinkMatchingViewModels) { if (threeLinkMatchingViewModels != null) { foreach (var item in threeLinkMatchingViewModels) { _allBindingList.Add(new ThreeLinkFormViewModel(item)); } this.threeLinkFormViewModelBindingSource.DataSource = _allBindingList; } } public List SetMatching(List inputs, List alllist) { if (inputs == null || inputs.Count == 0) return null; var resultList = new List(); foreach (var item in inputs) { var result = AsstesAutoMatchingHelper.ThreeLinkAutoMatching(item, alllist); if (result != null) { resultList.Add(result); } else { resultList.Add(item); } } _allBindingList.Clear(); foreach (var item in resultList) { _allBindingList.Add(new ThreeLinkFormViewModel(item)); } this.threeLinkFormViewModelBindingSource.ResetBindings(false); return resultList; } //行点击事件 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); } } }