namespace HStation.WinFrmUI
|
{
|
public partial class XhsProjectHomeTitleCtrl : DevExpress.XtraEditors.XtraUserControl
|
{
|
public XhsProjectHomeTitleCtrl()
|
{
|
InitializeComponent();
|
}
|
|
/// <summary>
|
/// 跳转事件
|
/// </summary>
|
public event Action<string> JumpEvent;
|
|
private List<XhsProjectHomeTitleViewModel> _allBindingList = null;
|
|
/// <summary>
|
/// 绑定数据
|
/// </summary>
|
public async void SetBindingData()
|
{
|
_allBindingList = new List<XhsProjectHomeTitleViewModel>();
|
|
var vmProject = new XhsProjectHomeTitleViewModel();
|
vmProject.Id = HStation.Xhs.DataType.XhsProject;
|
vmProject.Name = "项目数量";
|
vmProject.Count = await BLLFactory<HStation.BLL.XhsProject>.Instance.GetCount();
|
vmProject.Image = XhsMainSvgImageHelper.Project;
|
_allBindingList.Add(vmProject);
|
|
var vmCooling = new XhsProjectHomeTitleViewModel();
|
vmCooling.Id = HStation.Assets.DataType.CoolingMain;
|
vmCooling.Name = "冷却塔型号";
|
vmCooling.Count = await BLLFactory<HStation.BLL.AssetsCoolingMain>.Instance.GetCount();
|
vmCooling.Image = AssetsMainSvgImageHelper.Cooling;
|
_allBindingList.Add(vmCooling);
|
|
var vmPump = new XhsProjectHomeTitleViewModel();
|
vmPump.Id = HStation.Assets.DataType.PumpMain;
|
vmPump.Name = "水泵型号";
|
vmPump.Count = await BLLFactory<HStation.BLL.AssetsPumpMain>.Instance.GetCount();
|
vmPump.Image = AssetsMainSvgImageHelper.Pump;
|
_allBindingList.Add(vmPump);
|
|
var vmValve = new XhsProjectHomeTitleViewModel();
|
vmValve.Id = HStation.Assets.DataType.ValveMain;
|
vmValve.Name = "阀门型号";
|
vmValve.Count = await BLLFactory<HStation.BLL.AssetsValveMain>.Instance.GetCount();
|
vmValve.Image = AssetsMainSvgImageHelper.Valve;
|
_allBindingList.Add(vmValve);
|
|
var vmExchanger = new XhsProjectHomeTitleViewModel();
|
vmExchanger.Id = HStation.Assets.DataType.ExchangerMain;
|
vmExchanger.Name = "换热器型号";
|
vmExchanger.Count = await BLLFactory<HStation.BLL.AssetsExchangerMain>.Instance.GetCount();
|
vmExchanger.Image = AssetsMainSvgImageHelper.Exchanger;
|
_allBindingList.Add(vmExchanger);
|
|
this.xhsProjectHomeTitleViewModelBindingSource.DataSource = _allBindingList;
|
this.xhsProjectHomeTitleViewModelBindingSource.ResetBindings(false);
|
}
|
|
//跳转
|
private void layoutView1_FieldValueClick(object sender, DevExpress.XtraGrid.Views.Layout.Events.FieldValueClickEventArgs e)
|
{
|
if (e.Column != this.colName)
|
{
|
return;
|
}
|
var row = this.layoutView1.GetRow(e.RowHandle) as XhsProjectHomeTitleViewModel;
|
if (row == null)
|
{
|
return;
|
}
|
this.JumpEvent?.Invoke(row.Id);
|
}
|
|
|
|
}
|
}
|