lixiaojun
2025-02-18 1f7091dac2a5dddf4a0a40acb0940d3787cf35f5
WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/XhsProjectSimulationMgrPage.cs
@@ -1,5 +1,4 @@
using DevExpress.Drawing;
using DevExpress.Utils.Svg;
using DevExpress.Utils.Svg;
using DevExpress.XtraBars.Docking;
using DevExpress.XtraBars.Docking2010.Views;
using Yw.Vmo;
@@ -17,11 +16,11 @@
            this.PageTitle.SvgImageSize = new Size(24, 24);
            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.ProjectSiteWorkingReloadEvent += SimulationFunctionMgrCtrl1_ProjectSiteWorkingReloadEvent;
            this.simulationFunctionMgrCtrl1.CreateProjectSiteSchemeEvent += SimulationFunctionMgrCtrl1_CreateProjectSiteSchemeEvent;
            this.simulationFunctionMgrCtrl1.ProjectSiteSchemeAppendEvent += SimulationFunctionMgrCtrl1_ProjectSiteSchemeAppendEvent;
            this.simulationFunctionMgrCtrl1.ProjectSiteSchemeUpdateEvent += SimulationFunctionMgrCtrl1_ProjectSiteSchemeUpdateEvent;
@@ -120,21 +119,37 @@
                {
                    var page = new XhsProjectSimulationCorePage();
                    page.PageTitle.HeaderSvgImage = svgImage;
                    page.AppendWorkingEvent += (working) =>
                    page.GetModelEvent += (s) =>
                    {
                        //增加工况事件
                        this.simulationFunctionMgrCtrl1.AppendWorking(scheme, working);
                    };
                    page.SaveModelEvent += (rhs) =>
                    {
                        //保存模型事件
                        return this.simulationFunctionMgrCtrl1.SaveModel(scheme, rhs);
                        //获取模型事件
                        return this.simulationFunctionMgrCtrl1.GetModel(scheme);
                    };
                    page.RefreshModelEvent += () =>
                    {
                        //刷新模型事件
                        return this.simulationFunctionMgrCtrl1.RefreshModel(scheme);
                    };
                    page.AppendWorkingEvent += (working) =>
                    {
                        //增加工况事件
                        this.simulationFunctionMgrCtrl1.AppendWorking(scheme, working);
                    };
                    page.UpdateWorkingEvent += (working) =>
                    {
                        //更新工况事件
                        this.simulationFunctionMgrCtrl1.UpdateWorking(scheme, working);
                    };
                    page.RemoveWorkingEvent += (working) =>
                    {
                        //移除工况事件
                        this.simulationFunctionMgrCtrl1.RemoveWorking(scheme, working);
                    };
                    page.ReloadWorkingEvent += (dict) =>
                    {
                        //重载工况事件
                        this.simulationFunctionMgrCtrl1.ReloadWorking(scheme, dict);
                    };
                    page.UpdateSchemeEvent += (rhs) =>
                    {
                        //更新方案事件
@@ -146,44 +161,6 @@
                        this.simulationFunctionMgrCtrl1.RemoveScheme(rhs);
                    };
                    page.SetBindingData(project, projectSite, scheme, hydroInfo, allWorkingCheckedListDict);
                    CreatePage(page, guid);
                }
            }
        }
        //显示项目站工况事件
        private void SimulationFunctionMgrCtrl1_ShowProjectSiteWorkingEvent
            (
                XhsProjectVmo project,
                XhsProjectSiteVmo projectSite,
                XhsSchemeVmo scheme,
                Yw.Model.HydroModelInfo hydroInfo,
                HydroWorkingVmo working,
                SvgImage svgImage
            )
        {
            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);
                }
            }
@@ -246,7 +223,7 @@
                Modular = this.PageGuid.Modular,
                MoudingType = eMoudingType.Tab,
                Function = SimulationFunctionHelper.Simulation,
                TagName = projectSite.ID.ToString()
                TagName = $"{project.ID}-{projectSite.ID}-{scheme?.ID}"
            };
            var page = FindPage(guid);
            if (page == null)
@@ -276,7 +253,7 @@
                Modular = this.PageGuid.Modular,
                MoudingType = eMoudingType.Tab,
                Function = SimulationFunctionHelper.Simulation,
                TagName = projectSite.ID.ToString()
                TagName = $"{project.ID}-{projectSite.ID}-{scheme?.ID}"
            };
            var page = FindPage(guid);
            if (page == null)
@@ -291,29 +268,49 @@
            ctrl.UpdateWorkingCheckedList(working, hasChecked);
        }
        //项目站工况选择重载事件
        private void SimulationFunctionMgrCtrl1_ProjectSiteWorkingReloadEvent
            (
                XhsProjectVmo project,
                XhsProjectSiteVmo projectSite,
                XhsSchemeVmo scheme,
                Dictionary<HydroWorkingVmo, bool> dict
            )
        {
            var guid = new PageGuid()
            {
                Modular = this.PageGuid.Modular,
                MoudingType = eMoudingType.Tab,
                Function = SimulationFunctionHelper.Simulation,
                TagName = $"{project.ID}-{projectSite.ID}-{scheme?.ID}"
            };
            var page = FindPage(guid);
            if (page == null)
            {
                return;
            }
            var ctrl = page as XhsProjectSimulationCorePage;
            if (ctrl == null)
            {
                return;
            }
            ctrl.ReloadWorkingCheckedList(dict);
        }
        //项目站方案创建事件
        private void SimulationFunctionMgrCtrl1_CreateProjectSiteSchemeEvent
            (
                XhsProjectVmo project,
                XhsProjectSiteVmo projectSite,
                Yw.Model.HydroModelInfo hydroInfo,
                List<XhsSchemeVmo> allSchemeList,
                SvgImage svgImage
            )
        {
            //WaitFormHelper.ShowWaitForm(this.FindForm(), "正在加载模型,请稍侯...");
            //var dlg = new AddXhsSchemeDlg();
            //dlg.Shown += delegate { WaitFormHelper.HideWaitForm(this.FindForm()); };
            //dlg.ReloadDataEvent += (rhs) =>
            //{
            //    this.simulationFunctionMgrCtrl1.AppendScheme(rhs);
            //};
            //dlg.SetBindingData(project, projectSite, hydroInfo);
            //dlg.ShowDialog();
            WaitFormHelper.ShowWaitForm(this.FindForm(), "正在加载模型,请稍侯...");
            WaitFormHelper.ShowWaitForm(this.FindForm(), "正在加载,请稍侯...");
            var dlg = new CreateXhsSchemeDlg();
            dlg.Shown += delegate { WaitFormHelper.HideWaitForm(this.FindForm()); };
            dlg.SetBindingData(project, projectSite, hydroInfo);
            dlg.SetBindingData(project, projectSite, hydroInfo, allSchemeList);
            dlg.ReloadDataEvent += (rhs) =>
            {
                this.simulationFunctionMgrCtrl1.AppendScheme(rhs);