namespace HStation.WinFrmUI
|
{
|
public partial class XhsProjectSimulationFourlinkMatchingListCtrl : DevExpress.XtraEditors.XtraUserControl
|
{
|
public XhsProjectSimulationFourlinkMatchingListCtrl()
|
{
|
InitializeComponent();
|
this.gridView1.SetNormalView(30);
|
this.gridView1.OptionsView.ShowDetailButtons = true;
|
this.gridView1.OptionsView.ShowGroupPanel = false;
|
}
|
|
private List<XhsProjectSimulationFourlinkMatchingViewModel> _allBindingList = new List<XhsProjectSimulationFourlinkMatchingViewModel>();
|
|
/// <summary>
|
/// 点击事件
|
/// </summary>
|
public event Action<string> RowClickEvent;
|
|
public void SetBindingData(List<FourlinkMatchingViewModel> fourLinkMatchingViewModels)
|
{
|
if (fourLinkMatchingViewModels != null)
|
{
|
foreach (var item in fourLinkMatchingViewModels)
|
{
|
_allBindingList.Add(new XhsProjectSimulationFourlinkMatchingViewModel(item));
|
}
|
this.fourLinkFormViewModelBindingSource.ResetBindings(false);
|
}
|
}
|
|
public List<FourlinkMatchingViewModel> SetMatching(List<FourlinkMatchingViewModel> inputs, List<AdaptingManageVmo> alllist)
|
{
|
if (inputs == null || inputs.Count == 0)
|
return null;
|
var resultList = new List<FourlinkMatchingViewModel>();
|
foreach (var item in inputs)
|
{
|
var result = AssetsMatchingHelper.MatchingFourlink(item, alllist);
|
if (result != null)
|
{
|
resultList.Add(result);
|
}
|
else
|
{
|
resultList.Add(item);
|
}
|
}
|
_allBindingList.Clear();
|
foreach (var item in resultList)
|
{
|
_allBindingList.Add(new XhsProjectSimulationFourlinkMatchingViewModel(item));
|
}
|
this.fourLinkFormViewModelBindingSource.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);
|
}
|
}
|
}
|