namespace HStation.WinFrmUI
{
public partial class XhsProjectBimfaceInfoCtrl : DevExpress.XtraEditors.XtraUserControl
{
public XhsProjectBimfaceInfoCtrl()
{
InitializeComponent();
this.bimfaceInterop3dContainer1.LoadCompletedEvent += BimfaceInterop3dContainer1_LoadCompletedEvent;
}
private long _project;//项目
private HStation.Vmo.XhsProjectSiteVmo _projectSite = null;//项目站
private Yw.Vmo.BimfaceFileRelationVmo _bimfaceFileRelation = null;//bimface关联
private Yw.Vmo.BimfaceFileVmo _bimfaceFile = null;//bimface文件
///
/// 绑定数据
///
public async Task SetBindingData(long prjId)
{
if (prjId == 0)
{
return;
}
_project = prjId;
if (_projectSite == null)
{
_projectSite = await BLLFactory.Instance.GetDefaultByProjectID(prjId);
}
await this.bimfaceInterop3dContainer1.InitialContainer();
}
///
/// 页面加载完成后触发
///
private async void BimfaceInterop3dContainer1_LoadCompletedEvent()
{
if (_project == 0)
{
return;
}
if (_projectSite == null)
{
return;
}
_bimfaceFileRelation = await BLLFactory.Instance
.GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, _projectSite.ID, HStation.Xhs.Purpose.Simulation);
if (_bimfaceFileRelation == null)
{
return;
}
_bimfaceFile = await BLLFactory.Instance.GetByID(_bimfaceFileRelation.BimfaceFileID);
if (_bimfaceFile == null)
{
return;
}
var viewToken = await BimfaceHelper.GetViewToken(_bimfaceFile.BimfaceId);
if (string.IsNullOrEmpty(viewToken))
{
return;
}
await this.bimfaceInterop3dContainer1.LoadView(viewToken);
}
}
}