| | |
| | | using DevExpress.XtraBars.Docking; |
| | | using DevExpress.Drawing; |
| | | using DevExpress.Utils.Svg; |
| | | using DevExpress.XtraBars.Docking; |
| | | using DevExpress.XtraBars.Docking2010.Views; |
| | | using Yw.Vmo; |
| | | using Yw.WinFrmUI.Page; |
| | |
| | | this.PageTitle.Caption = "水力模拟"; |
| | | this.PageTitle.HeaderSvgImage = this.svgImg32[0]; |
| | | this.PageTitle.SvgImageSize = new Size(24, 24); |
| | | |
| | | this.xhsProjectSimulationFunctionMgrCtrl1.ShowProjectInfoEvent += XhsProjectSimulationFunctionMgrCtrl1_ShowProjectInfoEvent; |
| | | this.xhsProjectSimulationFunctionMgrCtrl1.ShowProjectSimulationEvent += XhsProjectSimulationFunctionMgrCtrl1_ShowProjectSimulationEvent; |
| | | this.xhsProjectSimulationFunctionMgrCtrl1.CreateProjectSchemeEvent += XhsProjectSimulationFunctionMgrCtrl1_CreateProjectSchemeEvent; |
| | | this.xhsProjectSimulationFunctionMgrCtrl1.ShowProjectSchemeEvent += XhsProjectSimulationFunctionMgrCtrl1_ShowProjectSchemeEvent; |
| | | this.xhsProjectSimulationFunctionMgrCtrl1.CompareProjectWorkingEvent += XhsProjectSimulationFunctionMgrCtrl1_CompareProjectWorkingEvent; |
| | | this.xhsProjectSimulationFunctionMgrCtrl1.ShowProjectWorkingEvent += XhsProjectSimulationFunctionMgrCtrl1_ShowProjectWorkingEvent; |
| | | this.simulationFunctionMgrCtrl1.ShowProjectSiteInfoEvent += SimulationFunctionMgrCtrl1_ShowProjectSiteInfoEvent; |
| | | this.simulationFunctionMgrCtrl1.ShowProjectSiteSimulationEvent += SimulationFunctionMgrCtrl1_ShowProjectSiteSimulationEvent; |
| | | this.simulationFunctionMgrCtrl1.ShowProjectSiteWorkingEvent += SimulationFunctionMgrCtrl1_ShowProjectSiteWorkingEvent; |
| | | this.simulationFunctionMgrCtrl1.ProjectSiteWorkingAppendEvent += SimulationFunctionMgrCtrl1_ProjectSiteWorkingAppendEvent; |
| | | this.simulationFunctionMgrCtrl1.ProjectSiteWorkingUpdateEvent += SimulationFunctionMgrCtrl1_ProjectSiteWorkingUpdateEvent; |
| | | this.simulationFunctionMgrCtrl1.ProjectSiteWorkingRemoveEvent += SimulationFunctionMgrCtrl1_ProjectSiteWorkingRemoveEvent; |
| | | this.simulationFunctionMgrCtrl1.ProjectSiteWorkingCheckedEvent += SimulationFunctionMgrCtrl1_ProjectSiteWorkingCheckedEvent; |
| | | this.simulationFunctionMgrCtrl1.CreateProjectSiteSchemeEvent += SimulationFunctionMgrCtrl1_CreateProjectSiteSchemeEvent; |
| | | this.simulationFunctionMgrCtrl1.ProjectSiteSchemeAppendEvent += SimulationFunctionMgrCtrl1_ProjectSiteSchemeAppendEvent; |
| | | this.simulationFunctionMgrCtrl1.ProjectSiteSchemeUpdateEvent += SimulationFunctionMgrCtrl1_ProjectSiteSchemeUpdateEvent; |
| | | this.simulationFunctionMgrCtrl1.ProjectSiteSchemeRemoveEvent += SimulationFunctionMgrCtrl1_ProjectSiteSchemeRemoveEvent; |
| | | } |
| | | |
| | | |
| | | |
| | | private XhsProjectVmo _project = null;//项目 |
| | | private XhsProjectSiteVmo _projectSite = null;//项目站 |
| | | private List<HydroWorkingVmo> _allWorkingList = null;//所有工况列表 |
| | | private Dictionary<XhsSchemeVmo, List<HydroWorkingVmo>> _allSchemeWorkingDict = null;//所有方案工况字典 |
| | | private object _locker = new object();//锁定对象 |
| | | |
| | | private object _locker = new();//锁定对象 |
| | | |
| | | /// <summary> |
| | | /// 初始化数据源 |
| | |
| | | { |
| | | return; |
| | | } |
| | | var overlay = this.ShowOverlay(); |
| | | _projectSite = await BLLFactory<HStation.BLL.XhsProjectSite>.Instance.GetDefaultByProjectID(_project.ID); |
| | | var relation = await BLLFactory<Yw.BLL.HydroModelRelation>.Instance |
| | | .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, _projectSite.ID, HStation.Xhs.Purpose.Simulation); |
| | | if (relation == null) |
| | | { |
| | | return; |
| | | } |
| | | _allWorkingList = await BLLFactory<Yw.BLL.HydroWorking>.Instance.GetByModelID(relation.ModelID); |
| | | if (_allWorkingList == null) |
| | | { |
| | | _allWorkingList = new List<HydroWorkingVmo>(); |
| | | } |
| | | _allSchemeWorkingDict = new Dictionary<XhsSchemeVmo, List<HydroWorkingVmo>>(); |
| | | var allSchemeList = await BLLFactory<HStation.BLL.XhsScheme>.Instance.GetBySiteID(_projectSite.ID); |
| | | if (allSchemeList != null && allSchemeList.Count > 0) |
| | | { |
| | | foreach (var scheme in allSchemeList) |
| | | { |
| | | var schemeRelation = await BLLFactory<Yw.BLL.HydroModelRelation>.Instance |
| | | .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsScheme, scheme.ID, HStation.Xhs.Purpose.Simulation); |
| | | if (schemeRelation != null) |
| | | { |
| | | var allSchemeWorkingList = await BLLFactory<Yw.BLL.HydroWorking>.Instance.GetByModelID(schemeRelation.ModelID); |
| | | if (allSchemeWorkingList == null) |
| | | { |
| | | allSchemeWorkingList = new List<HydroWorkingVmo>(); |
| | | } |
| | | _allSchemeWorkingDict.Add(scheme, allSchemeWorkingList); |
| | | } |
| | | } |
| | | } |
| | | this.xhsProjectSimulationFunctionMgrCtrl1.SetBindingData(_project, _projectSite, _allWorkingList, _allSchemeWorkingDict); |
| | | overlay.Close(); |
| | | await this.simulationFunctionMgrCtrl1.SetBindingData(_project); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | |
| | | #region 功能面板 |
| | | |
| | | //显示项目信息事件 |
| | | private void XhsProjectSimulationFunctionMgrCtrl1_ShowProjectInfoEvent(DevExpress.Utils.Svg.SvgImage svgImage) |
| | | //显示项目站概况事件 |
| | | private void SimulationFunctionMgrCtrl1_ShowProjectSiteInfoEvent |
| | | ( |
| | | XhsProjectVmo project, |
| | | XhsProjectSiteVmo projectSite, |
| | | Yw.Model.HydroModelInfo hydroInfo, |
| | | SvgImage svgImage |
| | | ) |
| | | { |
| | | lock (_locker) |
| | | { |
| | |
| | | Modular = this.PageGuid.Modular, |
| | | MoudingType = eMoudingType.Tab, |
| | | Function = SimulationFunctionHelper.Info, |
| | | TagName = $"{project.ID}-{projectSite.ID}" |
| | | }; |
| | | if (!IsExistPage(guid, true)) |
| | | { |
| | | var page = new XhsProjectSimulationInfoPage(); |
| | | page.PageTitle.HeaderSvgImage = svgImage; |
| | | page.SetBindingData(_project, _projectSite); |
| | | page.SetBindingData(project, projectSite, hydroInfo); |
| | | CreatePage(page, guid); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //显示水力模拟事件 |
| | | private void XhsProjectSimulationFunctionMgrCtrl1_ShowProjectSimulationEvent(DevExpress.Utils.Svg.SvgImage svgImage) |
| | | //显示项目站水力模拟事件 |
| | | private void SimulationFunctionMgrCtrl1_ShowProjectSiteSimulationEvent |
| | | ( |
| | | XhsProjectVmo project, |
| | | XhsProjectSiteVmo projectSite, |
| | | XhsSchemeVmo scheme, |
| | | Yw.Model.HydroModelInfo hydroInfo, |
| | | Dictionary<HydroWorkingVmo, bool> allWorkingCheckedListDict, |
| | | SvgImage svgImage |
| | | ) |
| | | { |
| | | lock (_locker) |
| | | { |
| | |
| | | Modular = this.PageGuid.Modular, |
| | | MoudingType = eMoudingType.Tab, |
| | | Function = SimulationFunctionHelper.Simulation, |
| | | TagName = $"{project.ID}-{projectSite.ID}-{scheme?.ID}" |
| | | }; |
| | | if (!IsExistPage(guid, true)) |
| | | { |
| | |
| | | page.PageTitle.HeaderSvgImage = svgImage; |
| | | page.AppendWorkingEvent += (working) => |
| | | { |
| | | _allWorkingList.Add(working); |
| | | this.xhsProjectSimulationFunctionMgrCtrl1.AppendWorking(working); |
| | | //增加工况事件 |
| | | this.simulationFunctionMgrCtrl1.AppendWorking(scheme, working); |
| | | }; |
| | | page.SetBindingData(_project, _projectSite, _allWorkingList); |
| | | page.SaveModelEvent += (rhs) => |
| | | { |
| | | //保存模型事件 |
| | | return this.simulationFunctionMgrCtrl1.SaveModel(scheme, rhs); |
| | | }; |
| | | page.RefreshModelEvent += () => |
| | | { |
| | | //刷新模型事件 |
| | | return this.simulationFunctionMgrCtrl1.RefreshModel(scheme); |
| | | }; |
| | | page.UpdateSchemeEvent += (rhs) => |
| | | { |
| | | //更新方案事件 |
| | | this.simulationFunctionMgrCtrl1.UpdateScheme(rhs); |
| | | }; |
| | | page.RemoveSchemeEvent += (rhs) => |
| | | { |
| | | //移除方案事件 |
| | | this.simulationFunctionMgrCtrl1.RemoveScheme(rhs); |
| | | }; |
| | | page.SetBindingData(project, projectSite, scheme, hydroInfo, allWorkingCheckedListDict); |
| | | CreatePage(page, guid); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //创建项目方案事件 |
| | | private async void XhsProjectSimulationFunctionMgrCtrl1_CreateProjectSchemeEvent(DevExpress.Utils.Svg.SvgImage svgImage) |
| | | //显示项目站工况事件 |
| | | private void SimulationFunctionMgrCtrl1_ShowProjectSiteWorkingEvent |
| | | ( |
| | | XhsProjectVmo project, |
| | | XhsProjectSiteVmo projectSite, |
| | | XhsSchemeVmo scheme, |
| | | Yw.Model.HydroModelInfo hydroInfo, |
| | | HydroWorkingVmo working, |
| | | SvgImage svgImage |
| | | ) |
| | | { |
| | | if (_projectSite == null) |
| | | lock (_locker) |
| | | { |
| | | var guid = new PageGuid() |
| | | { |
| | | Modular = this.PageGuid.Modular, |
| | | MoudingType = eMoudingType.Tab, |
| | | Function = SimulationFunctionHelper.Working, |
| | | TagName = $"{project.ID}-{projectSite.ID}-{scheme?.ID}-{working.ID}" |
| | | }; |
| | | if (!IsExistPage(guid, true)) |
| | | { |
| | | var page = new XhsProjectSimulationWorkingPage(); |
| | | page.UpdateWorkingEvent += (rhs) => |
| | | { |
| | | this.simulationFunctionMgrCtrl1.UpdateWorking(scheme, rhs); |
| | | }; |
| | | page.RemoveWorkingEvent += (rhs) => |
| | | { |
| | | this.simulationFunctionMgrCtrl1.RemoveWorking(scheme, rhs); |
| | | }; |
| | | page.PageTitle.HeaderSvgImage = svgImage; |
| | | page.SetBindingData(project, projectSite, scheme, hydroInfo, working); |
| | | CreatePage(page, guid); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 项目站工况增加事件 |
| | | /// </summary> |
| | | private void SimulationFunctionMgrCtrl1_ProjectSiteWorkingAppendEvent |
| | | ( |
| | | XhsProjectVmo project, |
| | | XhsProjectSiteVmo projectSite, |
| | | XhsSchemeVmo scheme, |
| | | HydroWorkingVmo working |
| | | ) |
| | | { |
| | | //目前增加工况都是通过模拟界面增加的,功能管理控件属于被通知的,其他地方暂时不关心工况增加 |
| | | } |
| | | |
| | | //项目站工况更新事件 |
| | | private void SimulationFunctionMgrCtrl1_ProjectSiteWorkingUpdateEvent |
| | | ( |
| | | XhsProjectVmo project, |
| | | XhsProjectSiteVmo projectSite, |
| | | XhsSchemeVmo scheme, |
| | | HydroWorkingVmo working |
| | | ) |
| | | { |
| | | var guid = new PageGuid() |
| | | { |
| | | Modular = this.PageGuid.Modular, |
| | | MoudingType = eMoudingType.Tab, |
| | | Function = SimulationFunctionHelper.Simulation, |
| | | TagName = projectSite.ID.ToString() |
| | | }; |
| | | var page = FindPage(guid); |
| | | if (page == null) |
| | | { |
| | | return; |
| | | } |
| | | //var dlg = new AddXhsProjectSimulationSchemeDlg(); |
| | | //await dlg.SetBindingData(_projectSite.ID); |
| | | //dlg.ReloadDataEvent += (scheme) => |
| | | //{ |
| | | // this.xhsProjectSimulationFunctionMgrCtrl1.AppendScheme(scheme); |
| | | //}; |
| | | //dlg.ShowDialog(); |
| | | var ctrl = page as XhsProjectSimulationCorePage; |
| | | if (ctrl == null) |
| | | { |
| | | return; |
| | | } |
| | | ctrl.UpdateWorkingCheckedList(working); |
| | | } |
| | | |
| | | //项目站工况移除事件 |
| | | private void SimulationFunctionMgrCtrl1_ProjectSiteWorkingRemoveEvent |
| | | ( |
| | | XhsProjectVmo project, |
| | | XhsProjectSiteVmo projectSite, |
| | | XhsSchemeVmo scheme, |
| | | HydroWorkingVmo working |
| | | ) |
| | | { |
| | | var guid = new PageGuid() |
| | | { |
| | | Modular = this.PageGuid.Modular, |
| | | MoudingType = eMoudingType.Tab, |
| | | Function = SimulationFunctionHelper.Simulation, |
| | | TagName = projectSite.ID.ToString() |
| | | }; |
| | | var page = FindPage(guid); |
| | | if (page == null) |
| | | { |
| | | return; |
| | | } |
| | | var ctrl = page as XhsProjectSimulationCorePage; |
| | | if (ctrl == null) |
| | | { |
| | | return; |
| | | } |
| | | ctrl.RemoveWorkingCheckedList(working); |
| | | } |
| | | |
| | | //项目站工况选择改变事件 |
| | | private void SimulationFunctionMgrCtrl1_ProjectSiteWorkingCheckedEvent |
| | | ( |
| | | XhsProjectVmo project, |
| | | XhsProjectSiteVmo projectSite, |
| | | XhsSchemeVmo scheme, |
| | | HydroWorkingVmo working, |
| | | bool hasChecked |
| | | ) |
| | | { |
| | | var guid = new PageGuid() |
| | | { |
| | | Modular = this.PageGuid.Modular, |
| | | MoudingType = eMoudingType.Tab, |
| | | Function = SimulationFunctionHelper.Simulation, |
| | | TagName = projectSite.ID.ToString() |
| | | }; |
| | | var page = FindPage(guid); |
| | | if (page == null) |
| | | { |
| | | return; |
| | | } |
| | | var ctrl = page as XhsProjectSimulationCorePage; |
| | | if (ctrl == null) |
| | | { |
| | | return; |
| | | } |
| | | ctrl.UpdateWorkingCheckedList(working, hasChecked); |
| | | } |
| | | |
| | | //项目站方案创建事件 |
| | | private void SimulationFunctionMgrCtrl1_CreateProjectSiteSchemeEvent |
| | | ( |
| | | XhsProjectVmo project, |
| | | XhsProjectSiteVmo projectSite, |
| | | Yw.Model.HydroModelInfo hydroInfo, |
| | | SvgImage svgImage |
| | | ) |
| | | { |
| | | WaitFormHelper.ShowWaitForm(this.FindForm(), "正在加载模型,请稍侯..."); |
| | | var dlg = new AddXhsSchemeDlg(); |
| | | // await dlg.SetBindingData(_project, _projectSite, _hydroInfo); |
| | | dlg.Shown += delegate { WaitFormHelper.HideWaitForm(this.FindForm()); }; |
| | | dlg.ReloadDataEvent += (rhs) => |
| | | { |
| | | this.simulationFunctionMgrCtrl1.AppendScheme(rhs); |
| | | }; |
| | | dlg.SetBindingData(project, projectSite, hydroInfo); |
| | | dlg.ShowDialog(); |
| | | |
| | | //var dlg = new CreateXhsSchemeDlg(); |
| | | //dlg.Shown += delegate { WaitFormHelper.HideWaitForm(this.FindForm()); }; |
| | | //dlg.SetBindingData(project, projectSite, hydroInfo); |
| | | //dlg.ShowDialog(); |
| | | } |
| | | |
| | | private void XhsProjectSimulationFunctionMgrCtrl1_ShowProjectSchemeEvent(XhsSchemeVmo arg1, DevExpress.Utils.Svg.SvgImage arg2) |
| | | //项目站方案增加事件 |
| | | private void SimulationFunctionMgrCtrl1_ProjectSiteSchemeAppendEvent |
| | | ( |
| | | XhsProjectVmo project, |
| | | XhsProjectSiteVmo projectSite, |
| | | XhsSchemeVmo scheme |
| | | ) |
| | | { |
| | | throw new NotImplementedException(); |
| | | //被动 |
| | | } |
| | | |
| | | private void XhsProjectSimulationFunctionMgrCtrl1_CompareProjectWorkingEvent(DevExpress.Utils.Svg.SvgImage obj) |
| | | //项目站方案更新事件 |
| | | private void SimulationFunctionMgrCtrl1_ProjectSiteSchemeUpdateEvent |
| | | ( |
| | | XhsProjectVmo project, |
| | | XhsProjectSiteVmo projectSite, |
| | | XhsSchemeVmo scheme |
| | | ) |
| | | { |
| | | throw new NotImplementedException(); |
| | | //被动 |
| | | } |
| | | |
| | | private void XhsProjectSimulationFunctionMgrCtrl1_ShowProjectWorkingEvent(HydroWorkingVmo arg1, DevExpress.Utils.Svg.SvgImage arg2) |
| | | //项目站方案移除事件 |
| | | private void SimulationFunctionMgrCtrl1_ProjectSiteSchemeRemoveEvent |
| | | ( |
| | | XhsProjectVmo project, |
| | | XhsProjectSiteVmo projectSite, |
| | | XhsSchemeVmo scheme |
| | | ) |
| | | { |
| | | throw new NotImplementedException(); |
| | | //被动 |
| | | } |
| | | |
| | | #endregion 功能面板 |
| | | #endregion |
| | | |
| | | #region TabbedView 相关事件处理程序 |
| | | |
| | |
| | | return; |
| | | } |
| | | |
| | | //正在关闭Document |
| | | private void tabbedView1_DocumentClosing(object sender, DocumentCancelEventArgs e) |
| | | { |
| | | var page = e.Document.Control as DocumentPage; |
| | | if (page == null) |
| | | { |
| | | return; |
| | | } |
| | | if (!page.CanClose()) |
| | | { |
| | | e.Cancel = true; |
| | | return; |
| | | } |
| | | page.UnRegistEvents(); |
| | | } |
| | | |
| | | //关闭 此时控件已经为空 |
| | | private void tabbedView1_DocumentClosed(object sender, DocumentEventArgs e) |
| | | { |
| | | } |
| | | |
| | | #endregion TabbedView 相关事件处理程序 |
| | | #endregion |
| | | |
| | | #region Page |
| | | |
| | |
| | | docPnl.Show(); |
| | | } |
| | | break; |
| | | |
| | | case eMoudingType.Tab: |
| | | { |
| | | this.tabbedView1.BeginUpdate(); |
| | |
| | | this.tabbedView1.Controller.Activate(doc); |
| | | } |
| | | break; |
| | | |
| | | default: break; |
| | | } |
| | | page.InitialDataSource(); |
| | |
| | | } |
| | | } |
| | | |
| | | #endregion Page |
| | | //查询Page |
| | | private DocumentPage FindPage(PageGuid pguid) |
| | | { |
| | | if (pguid == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (this.dockManager1.Panels != null && this.dockManager1.Panels.Count > 0) |
| | | { |
| | | foreach (DockPanel panel in this.dockManager1.Panels) |
| | | { |
| | | if (panel.Tag != null) |
| | | { |
| | | if (panel.Tag is PageGuid) |
| | | { |
| | | if ((panel.Tag as PageGuid).ToString() == pguid.ToString()) |
| | | { |
| | | return panel.ControlContainer.Controls[0] as DocumentPage; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (this.tabbedView1.Documents != null && this.tabbedView1.Documents.Count > 0) |
| | | { |
| | | foreach (BaseDocument doc in this.tabbedView1.Documents) |
| | | { |
| | | if (doc.Tag != null) |
| | | { |
| | | if (doc.Tag is PageGuid) |
| | | { |
| | | if ((doc.Tag as PageGuid).ToString() == pguid.ToString()) |
| | | { |
| | | return doc.Control as DocumentPage; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return default; |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | } |
| | | } |