lixiaojun
2024-09-11 ec0d0b6f8e3ac7791c736ae8aad69c4a1587cad9
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
namespace HStation.WinFrmUI
{
    public partial class XhsProjectBasicInfoBimfaceCtrl : DevExpress.XtraEditors.XtraUserControl
    {
        public XhsProjectBasicInfoBimfaceCtrl()
        {
            InitializeComponent();
            this.bimfaceInterop3dContainer1.LoadCompletedEvent += BimfaceInterop3dContainer1_LoadCompletedEvent;
        }
 
 
 
        private long _projectId;//项目id
 
        /// <summary>
        /// 绑定数据
        /// </summary>
        public async void SetBindingData(long projectId)
        {
            _projectId = projectId;
            await this.bimfaceInterop3dContainer1.InitialContainer();
        }
 
        /// <summary>
        /// 页面加载完成后触发
        /// </summary>
        private async void BimfaceInterop3dContainer1_LoadCompletedEvent()
        {
            var projectSite = await BLLFactory<HStation.BLL.XhsProjectSite>.Instance.GetDefaultByProjectID(_projectId);
            if (projectSite == null)
            {
                return;
            }
 
            var relation = await BLLFactory<Yw.BLL.BimfaceFileRelation>.Instance
                .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, projectSite.ID, Yw.Bimface.Purpose.Simulation);
            if (relation == null)
            {
                return;
            }
 
            var bimfaceFile = await BLLFactory<Yw.BLL.BimfaceFile>.Instance.GetByID(relation.BimfaceFileID);
            if (bimfaceFile == null)
            {
                return;
            }
 
            var viewToken = await BimfaceHelper.GetViewToken(bimfaceFile.BimfaceId);
            if (string.IsNullOrEmpty(viewToken))
            {
                return;
            }
            await this.bimfaceInterop3dContainer1.LoadView(viewToken);
 
        }
    }
}