namespace HStation.WinFrmUI
|
{
|
public partial class ValveMatchingCtrl : DevExpress.XtraEditors.XtraUserControl
|
{
|
public ValveMatchingCtrl()
|
{
|
InitializeComponent();
|
this.gridView1.SetNormalView(30);
|
this.gridView1.OptionsView.ShowDetailButtons = true;
|
this.gridView1.OptionsView.ShowGroupPanel = false;
|
}
|
|
private List<ValveMatchingViewModel> _allBindingList = null;
|
|
/// <summary>
|
/// 点击事件
|
/// </summary>
|
public event Action<string> RowClickEvent;
|
|
public void SetBindingData(List<ValveMatchingViewModel> valveMatchingViewModels)
|
{
|
if (_allBindingList != null)
|
{
|
_allBindingList = valveMatchingViewModels;
|
this.valveMatchingViewModelBindingSource.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)
|
{
|
var result = AsstesAutoMatchingHelper.ValveMatching(item, alllist);
|
if (result != null)
|
{
|
finishList.Add(result);
|
}
|
else
|
{
|
}
|
}
|
_allBindingList = finishList;
|
this.valveMatchingViewModelBindingSource.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);
|
}
|
}
|
}
|