namespace HStation.WinFrmUI
{
public partial class XhsProjectSimulationBimfaceInfoCtrl : DevExpress.XtraEditors.XtraUserControl
{
public XhsProjectSimulationBimfaceInfoCtrl()
{
InitializeComponent();
this.bimfaceInterop3dContainer1.LoadCompletedEvent += BimfaceInterop3dContainer1_LoadCompletedEvent;
}
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文件
///
/// 绑定数据
///
public async Task SetBindingData(XhsProjectVmo project, XhsProjectSiteVmo projectSite)
{
if (project == null)
{
return;
}
_project = project;
_projectSite = projectSite;
if (_projectSite == null)
{
_projectSite = await BLLFactory.Instance.GetDefaultByProjectID(_project.ID);
}
await this.bimfaceInterop3dContainer1.InitialContainer();
}
///
/// 页面加载完成后触发
///
private async void BimfaceInterop3dContainer1_LoadCompletedEvent()
{
if (_project == null)
{
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);
}
}
}