From 3a8ca9cfb9312444b7cbe9c1988829432c4ba80d Mon Sep 17 00:00:00 2001 From: Shuxia Ning <NingShuxia0927@outlook.com> Date: 星期三, 11 十二月 2024 17:13:46 +0800 Subject: [PATCH] ExportToImage --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/XhsProjectSimulationMgrPage.cs | 249 ++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 200 insertions(+), 49 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/XhsProjectSimulationMgrPage.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/XhsProjectSimulationMgrPage.cs index 93e9243..74ca6ac 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/XhsProjectSimulationMgrPage.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/XhsProjectSimulationMgrPage.cs @@ -1,4 +1,6 @@ -锘縰sing DevExpress.XtraBars.Docking; +锘縰sing DevExpress.Drawing; +using DevExpress.Utils.Svg; +using DevExpress.XtraBars.Docking; using DevExpress.XtraBars.Docking2010.Views; using Yw.Vmo; using Yw.WinFrmUI.Page; @@ -13,15 +15,21 @@ this.PageTitle.Caption = "姘村姏妯℃嫙"; this.PageTitle.HeaderSvgImage = this.svgImg32[0]; this.PageTitle.SvgImageSize = new Size(24, 24); - this.xhsProjectSimulationFunctionMgrCtrl1.ShowProjectSiteInfoEvent += XhsProjectSimulationFunctionMgrCtrl1_ShowProjectSiteInfoEvent; - this.xhsProjectSimulationFunctionMgrCtrl1.ShowProjectSiteSimulationEvent += XhsProjectSimulationFunctionMgrCtrl1_ShowProjectSiteSimulationEvent; - this.xhsProjectSimulationFunctionMgrCtrl1.ShowProjectSiteWorkingEvent += XhsProjectSimulationFunctionMgrCtrl1_ShowProjectSiteWorkingEvent; - this.xhsProjectSimulationFunctionMgrCtrl1.ProjectSiteWorkingCheckedEvent += XhsProjectSimulationFunctionMgrCtrl1_ProjectSiteWorkingCheckedEvent; + 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 object _locker = new object();//閿佸畾瀵硅薄 - + private object _locker = new();//閿佸畾瀵硅薄 /// <summary> /// 鍒濆鍖栨暟鎹簮 @@ -33,7 +41,7 @@ { return; } - await this.xhsProjectSimulationFunctionMgrCtrl1.SetBindingData(_project); + await this.simulationFunctionMgrCtrl1.SetBindingData(_project); } /// <summary> @@ -61,8 +69,13 @@ #region 鍔熻兘闈㈡澘 //鏄剧ず椤圭洰绔欐鍐典簨浠� - private void XhsProjectSimulationFunctionMgrCtrl1_ShowProjectSiteInfoEvent - (XhsProjectVmo project, XhsProjectSiteVmo projectSite, Yw.Model.HydroModelInfo hydroInfo, DevExpress.Utils.Svg.SvgImage svgImage) + private void SimulationFunctionMgrCtrl1_ShowProjectSiteInfoEvent + ( + XhsProjectVmo project, + XhsProjectSiteVmo projectSite, + Yw.Model.HydroModelInfo hydroInfo, + SvgImage svgImage + ) { lock (_locker) { @@ -71,6 +84,7 @@ Modular = this.PageGuid.Modular, MoudingType = eMoudingType.Tab, Function = SimulationFunctionHelper.Info, + TagName = $"{project.ID}-{projectSite.ID}" }; if (!IsExistPage(guid, true)) { @@ -83,8 +97,15 @@ } //鏄剧ず椤圭洰绔欐按鍔涙ā鎷熶簨浠� - private void XhsProjectSimulationFunctionMgrCtrl1_ShowProjectSiteSimulationEvent - (XhsProjectVmo project, XhsProjectSiteVmo projectSite, Yw.Model.HydroModelInfo hydroInfo, Dictionary<HydroWorkingVmo, bool> allWorkingCheckedListDict, 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) { @@ -93,7 +114,7 @@ Modular = this.PageGuid.Modular, MoudingType = eMoudingType.Tab, Function = SimulationFunctionHelper.Simulation, - TagName = projectSite.ID.ToString() + TagName = $"{project.ID}-{projectSite.ID}-{scheme?.ID}" }; if (!IsExistPage(guid, true)) { @@ -101,17 +122,45 @@ page.PageTitle.HeaderSvgImage = svgImage; page.AppendWorkingEvent += (working) => { - this.xhsProjectSimulationFunctionMgrCtrl1.AppendWorking(working); + //澧炲姞宸ュ喌浜嬩欢 + this.simulationFunctionMgrCtrl1.AppendWorking(scheme, working); }; - page.SetBindingData(project, projectSite, hydroInfo, allWorkingCheckedListDict); + 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 void XhsProjectSimulationFunctionMgrCtrl1_ShowProjectSiteWorkingEvent - (XhsProjectVmo project, XhsProjectSiteVmo projectSite, Yw.Model.HydroModelInfo hydroInfo, HydroWorkingVmo working, DevExpress.Utils.Svg.SvgImage svgImage) + private void SimulationFunctionMgrCtrl1_ShowProjectSiteWorkingEvent + ( + XhsProjectVmo project, + XhsProjectSiteVmo projectSite, + XhsSchemeVmo scheme, + Yw.Model.HydroModelInfo hydroInfo, + HydroWorkingVmo working, + SvgImage svgImage + ) { lock (_locker) { @@ -120,21 +169,107 @@ Modular = this.PageGuid.Modular, MoudingType = eMoudingType.Tab, Function = SimulationFunctionHelper.Working, - TagName = working.ID.ToString() + 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, hydroInfo, working); + 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 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 XhsProjectSimulationFunctionMgrCtrl1_ProjectSiteWorkingCheckedEvent - (XhsProjectVmo project, XhsProjectSiteVmo projectSite, Yw.Model.HydroModelInfo hydroInfo, HydroWorkingVmo working, bool hasChecked) + private void SimulationFunctionMgrCtrl1_ProjectSiteWorkingCheckedEvent + ( + XhsProjectVmo project, + XhsProjectSiteVmo projectSite, + XhsSchemeVmo scheme, + HydroWorkingVmo working, + bool hasChecked + ) { var guid = new PageGuid() { @@ -156,44 +291,62 @@ ctrl.UpdateWorkingCheckedList(working, hasChecked); } - - - //鍒涘缓椤圭洰鏂规浜嬩欢 - private void XhsProjectSimulationFunctionMgrCtrl1_CreateProjectSchemeEvent(DevExpress.Utils.Svg.SvgImage svgImage) + //椤圭洰绔欐柟妗堝垱寤轰簨浠� + private void SimulationFunctionMgrCtrl1_CreateProjectSiteSchemeEvent + ( + XhsProjectVmo project, + XhsProjectSiteVmo projectSite, + Yw.Model.HydroModelInfo hydroInfo, + SvgImage svgImage + ) { - //if (_projectSite == null) - //{ - // return; - //} - //var dlg = new AddXhsProjectSimulationSchemeDlg(); - //await dlg.SetBindingData(_projectSite.ID); - //dlg.ReloadDataEvent += (scheme) => - //{ - // this.xhsProjectSimulationFunctionMgrCtrl1.AppendScheme(scheme); - //}; - //dlg.ShowDialog(); - + WaitFormHelper.ShowWaitForm(this.FindForm(), "姝e湪鍔犺浇妯″瀷锛岃绋嶄警..."); 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 + ) { - + //琚姩 } - //姣旇緝椤圭洰宸ュ喌浜嬩欢 - private void XhsProjectSimulationFunctionMgrCtrl1_CompareProjectWorkingEvent(DevExpress.Utils.Svg.SvgImage obj) + //椤圭洰绔欐柟妗堟洿鏂颁簨浠� + private void SimulationFunctionMgrCtrl1_ProjectSiteSchemeUpdateEvent + ( + XhsProjectVmo project, + XhsProjectSiteVmo projectSite, + XhsSchemeVmo scheme + ) { - + //琚姩 } - //鏄剧ず椤圭洰宸ュ喌浜嬩欢 - private void XhsProjectSimulationFunctionMgrCtrl1_ShowProjectWorkingEvent(HydroWorkingVmo arg1, DevExpress.Utils.Svg.SvgImage arg2) + //椤圭洰绔欐柟妗堢Щ闄や簨浠� + private void SimulationFunctionMgrCtrl1_ProjectSiteSchemeRemoveEvent + ( + XhsProjectVmo project, + XhsProjectSiteVmo projectSite, + XhsSchemeVmo scheme + ) { - + //琚姩 } #endregion @@ -430,7 +583,6 @@ docPnl.Show(); } break; - case eMoudingType.Tab: { this.tabbedView1.BeginUpdate(); @@ -449,7 +601,6 @@ this.tabbedView1.Controller.Activate(doc); } break; - default: break; } page.InitialDataSource(); -- Gitblit v1.9.3