namespace HStation.WinFrmUI { public partial class XhsProjectHomeTitleCtrl : DevExpress.XtraEditors.XtraUserControl { public XhsProjectHomeTitleCtrl() { InitializeComponent(); } /// /// 跳转事件 /// public event Action JumpEvent; private List _allBindingList = null; /// /// 绑定数据 /// public async void SetBindingData() { _allBindingList = new List(); var vmProject = new XhsProjectHomeTitleViewModel(); vmProject.Id = HStation.Xhs.DataType.XhsProject; vmProject.Name = "项目数量"; vmProject.Count = await BLLFactory.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.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.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.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.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); } } }