duheng
2024-11-05 21dd2ae9704c484d5d75b2ed980e5402505da7dc
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
using Yw.Model;
 
namespace Yw.WinFrmUI
{
    public partial class HydroCompressorListCtrl : DevExpress.XtraEditors.XtraUserControl, IHydroParterList
    {
        public HydroCompressorListCtrl()
        {
            InitializeComponent();
            this.gridView1.SetNormalView(30);
            this.gridView1.RegistCustomDrawRowIndicator(40);
        }
 
        /// <summary>
        /// 水力点击事件
        /// </summary>
        public event Action<Yw.Model.HydroParterInfo> HydroClickEvent;
        public event Action<List<HydroParterInfo>> HydroChangedEvent;
 
        /// <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<HydroCompressorViewModel> _allBindingList = null;//所有绑定列表
 
        /// <summary>
        /// 绑定数据
        /// </summary>
        /// <param name="allExchangerList"></param>
        public void SetBindingData(Yw.Model.HydroModelInfo hydroInfo, List<HydroCalcuResult> allCalcuResultList)
        {
            _allBindingList = new List<HydroCompressorViewModel>();
            if (hydroInfo != null && hydroInfo.Compressors != null && hydroInfo.Compressors.Count > 0)
            {
                foreach (var compressor in hydroInfo.Compressors)
                {
                    var calcuLinkResult = allCalcuResultList?.Find(x => x.Code == compressor.Code) as HydroCalcuLinkResult;
                    var vm = new HydroCompressorViewModel(compressor, hydroInfo);
                    _allBindingList.Add(vm);
                }
            }
            this.hydroCompressorViewModelBindingSource.DataSource = _allBindingList;
            this.hydroCompressorViewModelBindingSource.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.colStartCode.Visible = false;
            this.colEndCode.Visible = false;
            this.colLinkStatus.Visible = true;
            this.colDiameter.Visible = false;
            this.colLength.Visible = false;
            this.colMaterial.Visible = false;
            this.colRoughness.Visible = true;
            this.colMinorLoss.Visible = true;
            this.colMinorLossK.Visible = true;
            this.colCalcuFlow.Visible = false;
            this.colCalcuVelocity.Visible = false;
            this.colCalcuHeadLoss.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.colStartCode.Visible = false;
            this.colEndCode.Visible = false;
            this.colLinkStatus.Visible = true;
            this.colDiameter.Visible = true;
            this.colLength.Visible = true;
            this.colMaterial.Visible = true;
            this.colRoughness.Visible = true;
            this.colMinorLoss.Visible = true;
            this.colMinorLossK.Visible = true;
            this.colCalcuFlow.Visible = false;
            this.colCalcuVelocity.Visible = false;
            this.colCalcuHeadLoss.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.colStartCode.Visible = false;
            this.colEndCode.Visible = false;
            this.colLinkStatus.Visible = true;
            this.colDiameter.Visible = true;
            this.colLength.Visible = true;
            this.colMaterial.Visible = true;
            this.colRoughness.Visible = true;
            this.colMinorLoss.Visible = true;
            this.colMinorLossK.Visible = true;
            this.colCalcuFlow.Visible = true;
            this.colCalcuVelocity.Visible = true;
            this.colCalcuHeadLoss.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 HydroCompressorViewModel;
            if (row == null)
            {
                return;
            }
            this.HydroClickEvent?.Invoke(row.Vmo);
        }
 
        public void SetBindingData(HydroModelInfo hydroInfo)
        {
            throw new NotImplementedException();
        }
 
        public void SetBulkSetView()
        {
            throw new NotImplementedException();
        }
 
        public void UpdateProperty()
        {
            throw new NotImplementedException();
        }
 
        public void UpdateProperty(HydroParterInfo parter)
        {
            throw new NotImplementedException();
        }
 
        public void UpdateProperty(List<HydroParterInfo> parterList)
        {
            throw new NotImplementedException();
        }
 
        public void UpdateCalcuProperty(List<HydroCalcuResult> allCalcuResultList)
        {
            throw new NotImplementedException();
        }
    }
}