namespace Yw.WinFrmUI
{
public partial class HydroCheckResultCtrl : DevExpress.XtraEditors.XtraUserControl
{
public HydroCheckResultCtrl()
{
InitializeComponent();
this.gridView1.SetNormalView(30);
this.gridView1.RegistCustomDrawRowIndicator(40);
this.gridView1.ShowFindPanel();
}
///
/// 点击构件事件
///
public event Action HydroClickEvent;
private List _allBindingList = null;
///
/// 绑定数据
///
public void SetBindingData(HydroCheckResult result)
{
if (result.Succeed)
{
this.peSucceed.Image = Yw.WinFrmUI.Hydro.Core.Properties.Resources.succeed_64;
}
else
{
this.peSucceed.Image = Yw.WinFrmUI.Hydro.Core.Properties.Resources.failed_64;
}
this.txtMode.EditValue = HydroCheckMode.Count();
this.txtType.EditValue = HydroCheckType.Count();
this.txtItems.EditValue = result.Items.Count;
this.txtSucceedItems.EditValue = result.Items.Count(x => !x.Failed);
this.txtFailedItems.EditValue = result.Items.Count(x => x.Failed);
_allBindingList = new List();
foreach (var item in result.Items)
{
var vm = new HydroCheckItemViewModel(item);
_allBindingList.Add(vm);
}
this.hydroCheckItemViewModelBindingSource.DataSource = _allBindingList;
this.hydroCheckItemViewModelBindingSource.ResetBindings(false);
}
//行点击
private void gridView1_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
{
var row = this.gridView1.GetRow(e.RowHandle) as HydroCheckItemViewModel;
if (row == null)
{
return;
}
this.HydroClickEvent?.Invoke(row.Code);
}
}
}