11
Shuxia Ning
2024-11-08 7ae4a1016ac49599caa7dacb2c3256e9744175c4
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
using DevExpress.XtraBars;
 
namespace HStation.WinFrmUI
{
    public partial class AddXhsSchemeDlg : DevExpress.XtraBars.Ribbon.RibbonForm
    {
        public AddXhsSchemeDlg()
        {
            InitializeComponent();
            this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon;
            this.ribbon.SetFormStyle();
 
            this.flyoutPanel1.BorderStyle = BorderStyle.None;
            this.flyoutPanel1.OwnerControl = this.sidePanel3dModel;
            this.flyoutPanel1.Options.AnimationType = DevExpress.Utils.Win.PopupToolWindowAnimation.Fade;
            this.flyoutPanel1.Options.AnchorType = DevExpress.Utils.Win.PopupToolWindowAnchor.Bottom;
 
 
            this.setSchemePumpListCtrl1.ShowFindPanel = false;
            this.setSchemeValveListCtrl1.ShowFindPanel = false;
            this.setSchemePipeListCtrl1.ShowFindPanel = false;
        }
 
 
        private HStation.Vmo.XhsProjectVmo _project = null;//项目
        private HStation.Vmo.XhsProjectSiteVmo _projectSite = null;//项目站
        private Yw.Model.HydroModelInfo _hydroInfo = null;//水力信息
 
        /// <summary>
        /// 绑定数据
        /// </summary>
        public async Task SetBindingData
            (
                HStation.Vmo.XhsProjectVmo project,
                HStation.Vmo.XhsProjectSiteVmo projectSite,
                Yw.Model.HydroModelInfo hydroInfo
            )
        {
 
            if (project == null)
            {
                return;
            }
            _project = project;
            _projectSite = projectSite;
            _hydroInfo = hydroInfo;
            if (_projectSite == null)
            {
                _projectSite = await BLLFactory<HStation.BLL.XhsProjectSite>.Instance.GetDefaultByProjectID(_project.ID);
            }
            if (_hydroInfo == null)
            {
                var hydroRelation = await BLLFactory<Yw.BLL.HydroModelRelation>.Instance
                    .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, _projectSite.ID, HStation.Xhs.Purpose.Simulation);
                _hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(hydroRelation.ModelID);
            }
 
            this.setSchemePumpListCtrl1.SetBindingData(_hydroInfo);
            this.setSchemeValveListCtrl1.SetBindingData(_hydroInfo);
            this.setSchemePipeListCtrl1.SetBindingData(_hydroInfo);
 
            ShowBimfaceCtrl();
        }
 
        #region Bimface
 
        //bimface控件
        private XhsProjectSimulationBimfaceCtrl _bimfaceCtrl = null;
 
        //获取 bimface 控件
        private async Task<XhsProjectSimulationBimfaceCtrl> GetBimfaceCtrl()
        {
            if (_bimfaceCtrl == null)
            {
                _bimfaceCtrl = new XhsProjectSimulationBimfaceCtrl();
                _bimfaceCtrl.Dock = DockStyle.Fill;
                await _bimfaceCtrl.InitialData(_project, _projectSite, () => _hydroInfo);
                _bimfaceCtrl.LoadCompletedEvent += () =>
                {
                    //view加载完成事件
                    if (_hydroInfo == null)
                    {
                        return;
                    }
                };
                _bimfaceCtrl.HydroMouseLeftClickEvent += (obj) =>
                {//鼠标左键点击事件
                    if (_hydroInfo == null)
                    {
                        return;
                    }
                };
            }
            return _bimfaceCtrl;
        }
 
        //显示 bimface 控件
        private async void ShowBimfaceCtrl()
        {
            var bimfaceCtrl = await GetBimfaceCtrl();
            this.sidePanel3dModel.Controls.Clear();
            this.sidePanel3dModel.Controls.Add(bimfaceCtrl);
        }
 
        private void SelectBimfaceParter()
        {
 
        }
 
        #endregion
 
        private void barCek_CheckedChanged(object sender, ItemClickEventArgs e)
        {
 
            if (!this.flyoutPanel1.Visible)
            {
                this.flyoutPanel1.ShowPopup();
            }
            else
            {
                this.flyoutPanel1.HidePopup();
            }
 
        }
         
    }
}