lixiaojun
2024-10-21 24ec8c3cf6e75efdcb5f12d73ada86b53c677959
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
namespace Yw.WinFrmUI
{
    public partial class HydroHydrantListCtrl : DevExpress.XtraEditors.XtraUserControl, IViewHydroParterList
    {
        public HydroHydrantListCtrl()
        {
            InitializeComponent();
            this.gridView1.SetNormalView(30);
            this.gridView1.RegistCustomDrawRowIndicator(40);
        }
 
        /// <summary>
        /// 水力点击事件
        /// </summary>
        public event Action<Yw.Model.HydroParterInfo> HydroClickEvent;
 
        /// <summary>
        /// 显示查询面板
        /// </summary>
        [Browsable(true)]
        [Description("显示查询面板")]
        [DefaultValue(true)]
        public bool ShowFindPanel
        {
            get { return this.gridView1.OptionsFind.AlwaysVisible; }
            set { this.gridView1.OptionsFind.AlwaysVisible = value; }
        }
 
        /// <summary>
        /// 是否拥有水利列表
        /// </summary>
        public bool HasHydroList
        {
            get { return _allBindingList != null && _allBindingList.Count > 0; }
        }
 
 
 
        //所有绑定列表
        private List<HydroHydrantViewModel> _allBindingList = null;
 
        /// <summary>
        /// 绑定数据
        /// </summary>
        public void SetBindingData(Yw.Model.HydroModelInfo hydroInfo, List<IHydroCalcuResult> allCalcuResultList)
        {
            _allBindingList = new List<HydroHydrantViewModel>();
            if (hydroInfo != null && hydroInfo.Hydrants != null && hydroInfo.Hydrants.Count > 0)
            {
                foreach (var hydrant in hydroInfo.Hydrants)
                {
                    var calcuNodeResult = allCalcuResultList?.Find(x => x.Code == hydrant.Code) as HydroCalcuNodeResult;
                    var vm = new HydroHydrantViewModel(hydrant, calcuNodeResult);
                    _allBindingList.Add(vm);
                }
            }
            this.hydroHydrantViewModelBindingSource.DataSource = _allBindingList;
            this.hydroHydrantViewModelBindingSource.ResetBindings(false);
            if (allCalcuResultList == null || allCalcuResultList.Count < 1)
            {
                SetNormalView();
            }
            else
            {
                SetCalcuView();
            }
        }
 
        /// <summary>
        /// 设置简单显示模式
        /// </summary>
        public void SetSimpleView()
        {
            this.colDbLocked.Visible = true;
            this.colCode.Visible = true;
            this.colName.Visible = true;
            this.colModelType.Visible = true;
            this.colHasDb.Visible = true;
            this.colCoefficient.Visible = true;
            this.colQuality.Visible = false;
            this.colElev.Visible = false;
            this.colMinorLoss.Visible = false;
            this.colDemand.Visible = false;
            this.colDemandPattern.Visible = false;
            this.colCalcuPress.Visible = false;
            this.colCalcuHead.Visible = false;
            this.colCalcuDemand.Visible = false;
            this.colFlagsString.Visible = true;
            this.colDescription.Visible = true;
        }
 
        /// <summary>
        /// 设置正常显示模式
        /// </summary>
        public void SetNormalView()
        {
            this.colDbLocked.Visible = true;
            this.colCode.Visible = true;
            this.colName.Visible = true;
            this.colModelType.Visible = true;
            this.colHasDb.Visible = true;
            this.colCoefficient.Visible = true;
            this.colQuality.Visible = false;
            this.colElev.Visible = true;
            this.colMinorLoss.Visible = true;
            this.colDemand.Visible = true;
            this.colDemandPattern.Visible = false;
            this.colCalcuPress.Visible = false;
            this.colCalcuHead.Visible = false;
            this.colCalcuDemand.Visible = false;
            this.colFlagsString.Visible = true;
            this.colDescription.Visible = true;
        }
 
        /// <summary>
        /// 设置计算显示模式
        /// </summary>
        public void SetCalcuView()
        {
            this.colDbLocked.Visible = true;
            this.colCode.Visible = true;
            this.colName.Visible = true;
            this.colModelType.Visible = true;
            this.colHasDb.Visible = true;
            this.colCoefficient.Visible = true;
            this.colQuality.Visible = false;
            this.colElev.Visible = true;
            this.colMinorLoss.Visible = true;
            this.colDemand.Visible = true;
            this.colDemandPattern.Visible = false;
            this.colCalcuPress.Visible = true;
            this.colCalcuHead.Visible = true;
            this.colCalcuDemand.Visible = true;
            this.colFlagsString.Visible = true;
            this.colDescription.Visible = true;
        }
 
        //行点击事件
        private void gridView1_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
        {
            var row = this.gridView1.GetRow(e.RowHandle) as HydroHydrantViewModel;
            if (row == null)
            {
                return;
            }
            this.HydroClickEvent?.Invoke(row.Vmo);
        }
    }
}