lixiaojun
2025-02-20 25dd33f23a5e3f8386e25d9298743288a1b4c9f6
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
using Mapster;
using Yw.Vmo;
 
namespace HStation.WinFrmUI
{
    public partial class SimulationPumpAnalyCtrl : DevExpress.XtraEditors.XtraUserControl
    {
        public SimulationPumpAnalyCtrl()
        {
            InitializeComponent();
            this.layoutControl1.SetupLayoutControl();
            this.hydroPumpListStateViewCtrl1.SelectedChangedEvent += HydroPumpListStateViewCtrl1_SelectedChangedEvent;
        }
 
        private Yw.Model.HydroModelInfo _hydroInfo = null;//水力信息
        private HydroWorkingVmo _working = null;//工况
        private HydroPumpAnalyViewModel _vm = null;//视图
 
        /// <summary>
        /// 绑定数据
        /// </summary>
        public void SetBindingData
            (
                Yw.Model.HydroModelInfo hydroInfo,
                HydroWorkingVmo working,
                HydroCalcuResult calcuResult = null,
                bool isHead = false,
                List<HydroEvaluationVmo> allEvaluationList = null
            )
        {
            if (hydroInfo == null)
            {
                return;
            }
            if (working == null)
            {
                return;
            }
            _hydroInfo = hydroInfo.Adapt<Yw.Model.HydroModelInfo>();
            _working = working;
            if (calcuResult == null)
            {
                _hydroInfo.UpdateWorkingInfo(working.WorkingInfo);
                calcuResult = _hydroInfo.Calcu(Yw.EPAnet.CalcuMode.MinorLoss, isHead, allEvaluationList);
                if (!calcuResult.Succeed)
                {
                    return;
                }
            }
            _vm = HydroPumpAnalyHelper.Create(_hydroInfo, working, calcuResult, isHead, allEvaluationList);
            this.hydroPumpListStateViewCtrl1.SetBindingData(_hydroInfo);
        }
 
 
        //选择改变
        private void HydroPumpListStateViewCtrl1_SelectedChangedEvent(Yw.Model.HydroPumpInfo pump)
        {
            if (pump == null)
            {
                return;
            }
            if (_hydroInfo == null)
            {
                return;
            }
            if (_working == null)
            {
                return;
            }
            if (_vm == null)
            {
                return;
            }
            var dict = new Dictionary<HydroWorkingVmo, HydroPumpAnalyViewModel>()
            {
                { _working,_vm}
            };
            this.simulationPumpAnalyChartCtrl1.SetBindingData(_hydroInfo, pump, dict);
        }
 
 
 
    }
}