namespace HStation.WinFrmUI
|
{
|
public partial class ElbowsMatchingCtrl : DevExpress.XtraEditors.XtraUserControl
|
{
|
public ElbowsMatchingCtrl()
|
{
|
InitializeComponent();
|
this.gridView1.SetNormalView(30);
|
this.gridView1.OptionsView.ShowDetailButtons = true;
|
this.gridView1.OptionsView.ShowGroupPanel = false;
|
}
|
|
private List<ElbowsMatchingViewModel> _allBindingList = null;
|
|
/// <summary>
|
/// 点击事件
|
/// </summary>
|
public event Action<string> RowClickEvent;
|
|
public void SetBindingData(List<ElbowsMatchingViewModel> elbowsMatchingViewModels)
|
{
|
if (_allBindingList != null)
|
{
|
_allBindingList = elbowsMatchingViewModels;
|
this.elbowsMatchingViewModelBindingSource.DataSource = _allBindingList;
|
}
|
}
|
|
public List<ElbowsMatchingViewModel> SetMatching(List<ElbowsMatchingViewModel> inputs, List<AdaptingManageVmo> alllist)
|
{
|
if (inputs == null || inputs.Count == 0)
|
return null;
|
var resultList = new List<ElbowsMatchingViewModel>();
|
foreach (var item in inputs)
|
{
|
var result = AsstesAutoMatchingHelper.AutoMatching(item, alllist);
|
if (result != null)
|
{
|
resultList.Add(result);
|
}
|
else
|
{
|
item.MatchingType = Xhs.eMatchingType.Error;
|
resultList.Add(result);
|
}
|
}
|
_allBindingList = resultList;
|
this.elbowsMatchingViewModelBindingSource.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);
|
}
|
}
|
}
|