namespace HStation.WinFrmUI
|
{
|
public partial class XhsProjectSimulationPipeMatchingListCtrl : DevExpress.XtraEditors.XtraUserControl
|
{
|
public XhsProjectSimulationPipeMatchingListCtrl()
|
{
|
InitializeComponent();
|
this.gridView1.SetNormalView(30);
|
this.gridView1.OptionsView.ShowDetailButtons = true;
|
this.gridView1.OptionsView.ShowGroupPanel = false;
|
}
|
|
private List<XhsProjectSimulationPipeMatchingViewModel> _allBindingList = new List<XhsProjectSimulationPipeMatchingViewModel>();
|
|
/// <summary>
|
/// 点击事件
|
/// </summary>
|
public event Action<string> RowClickEvent;
|
|
public void SetBindingData(List<PipeMatchingViewModel> pipeLineMatchingViewModels)
|
{
|
if (pipeLineMatchingViewModels != null)
|
{
|
foreach (var item in pipeLineMatchingViewModels)
|
{
|
_allBindingList.Add(new XhsProjectSimulationPipeMatchingViewModel(item));
|
}
|
this.pipeLineFormViewModelBindingSource.DataSource = _allBindingList;
|
}
|
}
|
|
public List<PipeMatchingViewModel> SetMatching(List<PipeMatchingViewModel> inputs, List<AssetsPipeMainVmo> alllist)
|
{
|
if (inputs == null)
|
{
|
return null;
|
}
|
foreach (var item in inputs)
|
{
|
AssetsMatchingHelper.MatchingPipe(item, alllist);
|
}
|
_allBindingList.Clear();
|
foreach (var item in inputs)
|
{
|
_allBindingList.Add(new XhsProjectSimulationPipeMatchingViewModel(item));
|
}
|
this.pipeLineFormViewModelBindingSource.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);
|
}
|
}
|
}
|