namespace HStation.WinFrmUI
|
{
|
public partial class XhsProjectSimulationElbowsMatchingListCtrl : DevExpress.XtraEditors.XtraUserControl
|
{
|
public XhsProjectSimulationElbowsMatchingListCtrl()
|
{
|
InitializeComponent();
|
this.gridView1.SetNormalView(30);
|
this.gridView1.OptionsView.ShowDetailButtons = true;
|
this.gridView1.OptionsView.ShowGroupPanel = false;
|
}
|
|
private List<XhsProjectSimulationElbowsMatchingViewModel> _allBindingList = new List<XhsProjectSimulationElbowsMatchingViewModel>();
|
|
/// <summary>
|
/// 点击事件
|
/// </summary>
|
public event Action<string> RowClickEvent;
|
|
public void SetBindingData(List<ElbowMatchingViewModel> elbowsMatchingViewModels)
|
{
|
if (elbowsMatchingViewModels != null)
|
{
|
foreach (var item in elbowsMatchingViewModels)
|
{
|
_allBindingList.Add(new XhsProjectSimulationElbowsMatchingViewModel(item));
|
}
|
this.elbowsFormViewModelBindingSource.DataSource = _allBindingList;
|
}
|
}
|
|
public List<ElbowMatchingViewModel> SetMatching(List<ElbowMatchingViewModel> inputs, List<AssetsElbowMainVmo> alllist)
|
{
|
if (inputs == null || inputs.Count == 0)
|
return null;
|
foreach (var item in inputs)
|
{
|
AssetsMatchingHelper.MatchingElbow(item, alllist);
|
}
|
_allBindingList.Clear();
|
foreach (var item in inputs)
|
{
|
_allBindingList.Add(new XhsProjectSimulationElbowsMatchingViewModel(item));
|
}
|
this.elbowsFormViewModelBindingSource.ResetBindings(false);
|
return inputs;
|
}
|
|
//行点击事件
|
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);
|
}
|
}
|
}
|