namespace HStation.WinFrmUI { public partial class XhsProjectL3d2ViewPage : DocumentPage { public XhsProjectL3d2ViewPage() { InitializeComponent(); this.PageTitle.Caption = "水力视图"; this.PageTitle.HeaderSvgImage = Yw.WinFrmUI.HydroMainSvgImageHelper.Hydro; this.PageTitle.SvgImageSize = new Size(24, 24); } private XhsProjectVmo _project = null;//项目 private XhsProjectSiteVmo _projectSite = null;//项目站 /// /// 绑定数据 /// public async Task SetBindingData(long projectId) { var project = await BLLFactory.Instance.GetByID(projectId); if (project == null) { return; } SetBindingData(project); } /// /// 绑定数据 /// public void SetBindingData(XhsProjectVmo project) { if (project == null) { return; } _project = project; this.PageTitle.Caption = $"{_project.Name}\r\n水力视图"; } /// /// 绑定数据 /// public void SetBindingData(XhsProjectExtensionsVmo project) { if (project == null) { return; } _project = project; _projectSite = project.SiteList.FirstOrDefault(); this.PageTitle.Caption = $"{_project.Name}\r\n水力视图"; } /// /// 初始化数据源 /// public override void InitialDataSource() { base.InitialDataSource(); InitialData(); } //初始化数据 private async void InitialData() { if (_project == null) { return; } if (_projectSite == null) { _projectSite = await BLLFactory.Instance.GetDefaultByProjectID(_project.ID); } var relation = await BLLFactory.Instance .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, _projectSite.ID, Yw.Hydro.Purpose.Simulation); if (relation == null) { return; } var hydro = await BLLFactory.Instance.GetByID(relation.ModelID); if (hydro == null) { return; } var nw = hydro.ToL3d2NetworkViewModel(); this.viewerL3d21.Initial(nw); } } }