lixiaojun
2024-09-20 abbe29e54421c136aa6eb4ef11935c70d818101a
WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/01-info/XhsProjectSimulationBimfaceInfoCtrl.cs
@@ -1,4 +1,5 @@
namespace HStation.WinFrmUI
using HStation.Vmo;
namespace HStation.WinFrmUI
{
    public partial class XhsProjectSimulationBimfaceInfoCtrl : DevExpress.XtraEditors.XtraUserControl
    {
@@ -8,16 +9,26 @@
            this.bimfaceInterop3dContainer1.LoadCompletedEvent += BimfaceInterop3dContainer1_LoadCompletedEvent;
        }
        private long _projectId;//项目id
        private HStation.Vmo.XhsProjectVmo _project = null;//项目
        private HStation.Vmo.XhsProjectSiteVmo _projectSite = null;//项目站
        private Yw.Vmo.BimfaceFileRelationVmo _bimfaceFileRelation = null;//bimface关联
        private Yw.Vmo.BimfaceFileVmo _bimfaceFile = null;//bimface文件
        /// <summary>
        /// 绑定数据
        /// </summary>
        public async void SetBindingData(long projectId)
        public async Task SetBindingData(XhsProjectVmo project, XhsProjectSiteVmo projectSite)
        {
            _projectId = projectId;
            if (project == null)
            {
                return;
            }
            _project = project;
            _projectSite = projectSite;
            if (_projectSite == null)
            {
                _projectSite = await BLLFactory<HStation.BLL.XhsProjectSite>.Instance.GetDefaultByProjectID(_project.ID);
            }
            await this.bimfaceInterop3dContainer1.InitialContainer();
        }
@@ -26,27 +37,29 @@
        /// </summary>
        private async void BimfaceInterop3dContainer1_LoadCompletedEvent()
        {
            var projectSite = await BLLFactory<HStation.BLL.XhsProjectSite>.Instance.GetDefaultByProjectID(_projectId);
            if (projectSite == null)
            if (_project == null)
            {
                return;
            }
            if (_projectSite == null)
            {
                return;
            }
            var relation = await BLLFactory<Yw.BLL.BimfaceFileRelation>.Instance
                .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, projectSite.ID, HStation.Xhs.Purpose.Simulation);
            if (relation == null)
            _bimfaceFileRelation = await BLLFactory<Yw.BLL.BimfaceFileRelation>.Instance
                .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, _projectSite.ID, HStation.Xhs.Purpose.Simulation);
            if (_bimfaceFileRelation == null)
            {
                return;
            }
            var bimfaceFile = await BLLFactory<Yw.BLL.BimfaceFile>
                .Instance.GetByID(relation.BimfaceFileID);
            if (bimfaceFile == null)
            _bimfaceFile = await BLLFactory<Yw.BLL.BimfaceFile>.Instance.GetByID(_bimfaceFileRelation.BimfaceFileID);
            if (_bimfaceFile == null)
            {
                return;
            }
            var viewToken = await BimfaceHelper.GetViewToken(bimfaceFile.BimfaceId);
            var viewToken = await BimfaceHelper.GetViewToken(_bimfaceFile.BimfaceId);
            if (string.IsNullOrEmpty(viewToken))
            {
                return;