lixiaojun
2024-09-20 01a87d5aafc5cf63275d73f0c8cfd5e626d74261
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
namespace HStation.WinFrmUI
{
    public partial class XhsProjectSimulationUnMatchingListCtrl : DevExpress.XtraEditors.XtraUserControl
    {
        public XhsProjectSimulationUnMatchingListCtrl()
        {
            InitializeComponent();
            this.xhsProjectSimulationPumpUnMatchingListCtrl1.HydroClickEvent += XhsProjectSimulationPumpUnMatchingListCtrl1_HydroClickEvent;
            this.xhsProjectSimulationValveUnMatchingListCtrl1.HydroClickEvent += XhsProjectSimulationValveUnMatchingListCtrl1_HydroClickEvent;
            this.xhsProjectSimulationPipeUnMatchingListCtrl1.HydroClickEvent += XhsProjectSimulationPipeUnMatchingListCtrl1_HydroClickEvent;
            this.xhsProjectSimulationElbowUnMatchingListCtrl1.HydroClickEvent += XhsProjectSimulationElbowUnMatchingListCtrl1_HydroClickEvent;
            this.xhsProjectSimulationThreelinkUnMatchingListCtrl1.HydroClickEvent += XhsProjectSimulationThreelinkUnMatchingListCtrl1_HydroClickEvent;
            this.xhsProjectSimulationFourlinkUnMatchingListCtrl1.HydroClickEvent += XhsProjectSimulationFourlinkUnMatchingListCtrl1_HydroClickEvent;
        }
 
 
 
        #region 事件触发
 
        private void XhsProjectSimulationPipeUnMatchingListCtrl1_HydroClickEvent(Yw.Model.HydroPipeInfo obj)
        {
            this.HydroClickEvent?.Invoke(obj);
        }
 
        private void XhsProjectSimulationFourlinkUnMatchingListCtrl1_HydroClickEvent(Yw.Model.HydroFourlinkInfo obj)
        {
            this.HydroClickEvent?.Invoke(obj);
        }
 
        private void XhsProjectSimulationThreelinkUnMatchingListCtrl1_HydroClickEvent(Yw.Model.HydroThreelinkInfo obj)
        {
            this.HydroClickEvent?.Invoke(obj);
        }
 
        private void XhsProjectSimulationElbowUnMatchingListCtrl1_HydroClickEvent(Yw.Model.HydroElbowInfo obj)
        {
            this.HydroClickEvent?.Invoke(obj);
        }
 
        private void XhsProjectSimulationValveUnMatchingListCtrl1_HydroClickEvent(Yw.Model.HydroValveInfo obj)
        {
            this.HydroClickEvent?.Invoke(obj);
        }
 
        private void XhsProjectSimulationPumpUnMatchingListCtrl1_HydroClickEvent(Yw.Model.HydroPumpInfo obj)
        {
            this.HydroClickEvent?.Invoke(obj);
        }
 
        #endregion
 
        /// <summary>
        /// 水力点击事件
        /// </summary>
        public event Action<Yw.Model.HydroParterInfo> HydroClickEvent;
 
        /// <summary>
        /// 查看模型事件
        /// </summary>
        public event Action<List<Yw.Model.HydroParterInfo>> ViewModelEvent;
 
        /// <summary>
        /// 列表为空时隐藏Page
        /// </summary>
        [Browsable(true)]
        [Display(Name = "列表为空时隐藏Page")]
        [DisplayName("列表为空时隐藏Page")]
        public bool HidePageWhenListIsNull
        {
            get { return _hidePageWhenListIsNull; }
            set { _hidePageWhenListIsNull = value; }
        }
        private bool _hidePageWhenListIsNull = true;
 
        private Yw.Model.HydroModelInfo _hydroInfo = null;
 
        /// <summary>
        /// 绑定数据
        /// </summary>
        public void SetBindingData(Yw.Model.HydroModelInfo rhs)
        {
            _hydroInfo = rhs;
            if (_hydroInfo == null)
            {
                return;
            }
            var pumps = _hydroInfo.Pumps?.Where(x => string.IsNullOrEmpty(x.DbId)).ToList();
            this.xhsProjectSimulationPumpUnMatchingListCtrl1.SetBindingData(pumps);
            var valves = _hydroInfo.Valves?.Where(x => string.IsNullOrEmpty(x.DbId)).ToList();
            this.xhsProjectSimulationValveUnMatchingListCtrl1.SetBindingData(valves);
            var pipes = _hydroInfo.Pipes?.Where(x => string.IsNullOrEmpty(x.DbId)).ToList();
            this.xhsProjectSimulationPipeUnMatchingListCtrl1.SetBindingData(pipes);
            var elbows = _hydroInfo.Elbows?.Where(x => string.IsNullOrEmpty(x.DbId)).ToList();
            this.xhsProjectSimulationElbowUnMatchingListCtrl1.SetBindingData(elbows);
            var threelinks = _hydroInfo.Threelinks?.Where(x => string.IsNullOrEmpty(x.DbId)).ToList();
            this.xhsProjectSimulationThreelinkUnMatchingListCtrl1.SetBindingData(threelinks);
            var fourlinks = _hydroInfo.Fourlinks?.Where(x => string.IsNullOrEmpty(x.DbId)).ToList();
            this.xhsProjectSimulationFourlinkUnMatchingListCtrl1.SetBindingData(fourlinks);
 
            if (this.HidePageWhenListIsNull)
            {
                if (pumps == null || pumps.Count < 1)
                {
                    this.tabPagePumps.PageVisible = false;
                }
                else
                {
                    this.tabPagePumps.PageVisible = true;
                }
                if (valves == null || valves.Count < 1)
                {
                    this.tabPageValves.PageVisible = false;
                }
                else
                {
                    this.tabPageValves.PageVisible = true;
                }
                if (pipes == null || pipes.Count < 1)
                {
                    this.tabPagePipes.PageVisible = false;
                }
                else
                {
                    this.tabPagePipes.PageVisible = true;
                }
                if (elbows == null || elbows.Count < 1)
                {
                    this.tabPageElbows.PageVisible = false;
                }
                else
                {
                    this.tabPageElbows.PageVisible = true;
                }
                if (threelinks == null || threelinks.Count < 1)
                {
                    this.tabPageThreelinks.PageVisible = false;
                }
                else
                {
                    this.tabPageThreelinks.PageVisible = true;
                }
                if (fourlinks == null || fourlinks.Count < 1)
                {
                    this.tabPageFourlinks.PageVisible = false;
                }
                else
                {
                    this.tabPageFourlinks.PageVisible = true;
                }
            }
 
        }
 
        //模型查看
        private void btnModelView_Click(object sender, EventArgs e)
        {
            if (_hydroInfo == null)
            {
                return;
            }
            var parters = _hydroInfo.GetAllParters();
            parters = parters?.Where(x => string.IsNullOrEmpty(x.DbId)).ToList();
            this.ViewModelEvent?.Invoke(parters);
        }
    }
}