ningshuxia
23 小时以前 71c12ff40d58c3dbdde6867396dd99224e57fc32
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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);
        }
 
 
 
    }
}