using DevExpress.Utils; using NetTaste; namespace HStation.WinFrmUI { public partial class XhsSchemeMultiMgrPage : DocumentPage { public XhsSchemeMultiMgrPage() { InitializeComponent(); this.PageTitle.Caption = "项目方案"; this.PageTitle.HeaderSvgImage = this.svgImg32[0]; this.PageTitle.SvgImageSize = new Size(24, 24); } private XhsProjectStdDto _project = null; private Yw.Model.HydroModelInfo _hydroInfo = null; /// /// 绑定数据 /// /// 项目id public async Task SetBindingData(long projectId) { _project = await new BLL.XhsProjectStd().GetByID(projectId); this.PageTitle.Caption = $"{_project?.Name}\r\n方案管理"; var projectSite = await new BLL.XhsProjectSiteStd().GetDefaultByProjectID(_project.ID); if (projectSite == null) { return; } var relation = await new Yw.BLL.HydroModelRelation() .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, projectSite.ID, Yw.Bimface.Purpose.Simulation); if (relation == null) { return; } _hydroInfo = await new Yw.BLL.HydroModelInfo().GetByID(relation.ModelID); } /// /// 绑定数据 /// /// 项目 public void SetBindingData(HStation.Dto.XhsProjectStdDto project) { _project = project; this.PageTitle.Caption = $"{_project?.Name}\n方案管理"; } /// /// 初始化数据源 /// public override async void InitialDataSource() { base.InitialDataSource(); this.bimfaceInterop3dContainer1.LoadCompletedEvent += BimfaceInterop3dContainer1_LoadCompletedEvent; this.bimfaceInterop3dContainer1.ClickInEvent += BimfaceInterop3dContainer1_ClickInEvent; await this.bimfaceInterop3dContainer1.InitialContainer(); } /// /// 页面加载完成后触发 /// private async void BimfaceInterop3dContainer1_LoadCompletedEvent() { if (_project == null) { return; } var projectSite = await new BLL.XhsProjectSiteStd().GetDefaultByProjectID(_project.ID); if (projectSite == null) { return; } var relation = await new Yw.BLL.BimfaceFileRelationStd() .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, projectSite.ID, Yw.Bimface.Purpose.Simulation); if (relation == null) { return; } var bimfaceFile = await new Yw.BLL.BimfaceFileStd().GetByID(relation.BimfaceFileID); if (bimfaceFile == null) { return; } var viewToken = await BimfaceHelper.GetViewToken(bimfaceFile.BimfaceId); if (string.IsNullOrEmpty(viewToken)) { return; } await this.bimfaceInterop3dContainer1.LoadView(viewToken); } /// /// 点击事件 /// private void BimfaceInterop3dContainer1_ClickInEvent(Yw.WinFrmUI.Bimface.ClickIn3dInfo obj) { if (_hydroInfo == null) { return; } var pump = _hydroInfo.Pumps.Find(x => x.Code == obj.ObjectId); if (pump != null) { var hydroPump = new Yw.WinFrmUI.HydroPumpPropertyViewModel(pump); this.hydroParterPropertyCtrl1.SelectedObject = hydroPump; } } } }