Shuxia Ning
2024-11-11 750b85dc4c5562b9c0dc9b8c463e5cc5f0ad2553
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
using DevExpress.Utils.Svg;
 
namespace HStation.WinFrmUI
{
    public partial class XhsProjectSimulationFunctionMgrCtrl : DevExpress.XtraEditors.XtraUserControl
    {
        public XhsProjectSimulationFunctionMgrCtrl()
        {
            InitializeComponent();
            this.xhsProjectSimulationSchemeMgrCtrl1.ProjectSiteSelectedChangedEvent += XhsProjectSimulationSchemeMgrCtrl1_ProjectSiteSelectedChangedEvent;
        }
 
        /// <summary>
        /// 项目站选择改变事件
        /// </summary>
        public event Action<XhsProjectSiteVmo> ProjectSiteSelectedChangedEvent;
        /// <summary>
        /// 显示循环水项目信息事件
        /// </summary>
        public event Action<SvgImage> ShowXhsProjectInfoEvent;
        /// <summary>
        /// 显示循环水项目水力模拟事件
        /// </summary>
        public event Action<SvgImage> ShowXhsProjectSimulationEvent;
        /// <summary>
        /// 创建循环水项目方案事件
        /// </summary>
        public event Action<SvgImage> CreateXhsProjectSchemeEvent;
        /// <summary>
        /// 比较循环水项目方案事件
        /// </summary>
        public event Action<SvgImage> CompareXhsProjectSchemeEvent;
 
        private long _projectId;//项目id
        private XhsProjectVmo _project = null;//项目
        private XhsProjectSiteVmo _projectSite = null;//项目站
 
        /// <summary>
        /// 绑定数据
        /// </summary>
        public async Task SetBindingData(long projectId)
        {
            _projectId = projectId;
            _project = await BLLFactory<HStation.BLL.XhsProject>.Instance.GetByID(projectId);
            await SetBindingData(_project);
        }
 
        /// <summary>
        /// 绑定数据
        /// </summary>
        public async Task SetBindingData(XhsProjectVmo project)
        {
            if (project == null)
            {
                return;
            }
            _project = project;
            _projectId = project.ID;
            await this.xhsProjectSimulationSchemeMgrCtrl1.SetBindingData(project);
        }
 
        /// <summary>
        /// 重置绑定
        /// </summary>
        public void ResetBindingData()
        {
            this.ShowXhsProjectInfoEvent?.Invoke(this.svgImg32[0]);
        }
 
        //元素点击事件
        private void accordionControl1_ElementClick(object sender, DevExpress.XtraBars.Navigation.ElementClickEventArgs e)
        {
            var tag = e.Element.Tag?.ToString();
            switch (tag)
            {
                case "info":
                    {
                        this.ShowXhsProjectInfoEvent?.Invoke(this.svgImg32[0]);
                    }
                    break;
                case "simulation":
                    {
                        this.ShowXhsProjectSimulationEvent?.Invoke(this.svgImg32[1]);
                    }
                    break;
                case "scheme-create":
                    {
                        this.CreateXhsProjectSchemeEvent?.Invoke(this.svgImg32[3]);
                    }
                    break;
                case "scheme-compare":
                    {
                        this.CompareXhsProjectSchemeEvent?.Invoke(this.svgImg32[4]);
                    }
                    break;
                default: break;
            }
        }
 
        //项目站选择改变事件
        private void XhsProjectSimulationSchemeMgrCtrl1_ProjectSiteSelectedChangedEvent(XhsProjectSiteVmo obj)
        {
            _projectSite = obj;
            this.ProjectSiteSelectedChangedEvent?.Invoke(obj);
        }
 
        /// <summary>
        /// 添加方案
        /// </summary>
        public void AppendScheme(XhsSchemeVmo scheme)
        {
            this.xhsProjectSimulationSchemeMgrCtrl1.AppendScheme(scheme);
        }
 
 
 
    }
}