lixiaojun
2024-12-06 8d4f5bb9c83d42d1e83caccdb23665279f8e7094
WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/XhsProjectSimulationMgrPage.cs
@@ -1,4 +1,6 @@
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;
@@ -13,11 +15,15 @@
            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.xhsProjectSimulationFunctionMgrCtrl1.CreateProjectSiteSchemeEvent += XhsProjectSimulationFunctionMgrCtrl1_CreateProjectSiteSchemeEvent;
            this.simulationFunctionMgrCtrl1.ShowProjectSiteInfoEvent += XhsProjectSimulationFunctionMgrCtrl1_ShowProjectSiteInfoEvent;
            this.simulationFunctionMgrCtrl1.ShowProjectSiteSimulationEvent += XhsProjectSimulationFunctionMgrCtrl1_ShowProjectSiteSimulationEvent;
            this.simulationFunctionMgrCtrl1.ShowProjectSiteWorkingEvent += XhsProjectSimulationFunctionMgrCtrl1_ShowProjectSiteWorkingEvent;
            this.simulationFunctionMgrCtrl1.ProjectSiteWorkingUpdateEvent += XhsProjectSimulationFunctionMgrCtrl1_ProjectSiteWorkingUpdateEvent;
            this.simulationFunctionMgrCtrl1.ProjectSiteWorkingRemoveEvent += XhsProjectSimulationFunctionMgrCtrl1_ProjectSiteWorkingRemoveEvent;
            this.simulationFunctionMgrCtrl1.ProjectSiteWorkingCheckedEvent += XhsProjectSimulationFunctionMgrCtrl1_ProjectSiteWorkingCheckedEvent;
            this.simulationFunctionMgrCtrl1.CreateProjectSiteSchemeEvent += XhsProjectSimulationFunctionMgrCtrl1_CreateProjectSiteSchemeEvent;
            this.simulationFunctionMgrCtrl1.ShowProjectSiteSchemeEvent += XhsProjectSimulationFunctionMgrCtrl1_ShowProjectSiteSchemeEvent;
            this.simulationFunctionMgrCtrl1.ShowProjectSiteSchemeWorkingEvent += XhsProjectSimulationFunctionMgrCtrl1_ShowProjectSiteSchemeWorkingEvent;
        }
        private XhsProjectVmo _project = null;//项目
@@ -34,7 +40,7 @@
            {
                return;
            }
            await this.xhsProjectSimulationFunctionMgrCtrl1.SetBindingData(_project);
            await this.simulationFunctionMgrCtrl1.SetBindingData(_project);
        }
        /// <summary>
@@ -63,7 +69,7 @@
        //显示项目站概况事件
        private void XhsProjectSimulationFunctionMgrCtrl1_ShowProjectSiteInfoEvent
            (XhsProjectVmo project, XhsProjectSiteVmo projectSite, Yw.Model.HydroModelInfo hydroInfo, DevExpress.Utils.Svg.SvgImage svgImage)
            (XhsProjectVmo project, XhsProjectSiteVmo projectSite, Yw.Model.HydroModelInfo hydroInfo, SvgImage svgImage)
        {
            lock (_locker)
            {
@@ -85,7 +91,7 @@
        //显示项目站水力模拟事件
        private void XhsProjectSimulationFunctionMgrCtrl1_ShowProjectSiteSimulationEvent
            (XhsProjectVmo project, XhsProjectSiteVmo projectSite, Yw.Model.HydroModelInfo hydroInfo, Dictionary<HydroWorkingVmo, bool> allWorkingCheckedListDict, DevExpress.Utils.Svg.SvgImage svgImage)
            (XhsProjectVmo project, XhsProjectSiteVmo projectSite, Yw.Model.HydroModelInfo hydroInfo, Dictionary<HydroWorkingVmo, bool> allWorkingCheckedListDict, SvgImage svgImage)
        {
            lock (_locker)
            {
@@ -102,7 +108,7 @@
                    page.PageTitle.HeaderSvgImage = svgImage;
                    page.AppendWorkingEvent += (working) =>
                    {
                        this.xhsProjectSimulationFunctionMgrCtrl1.AppendWorking(working);
                        this.simulationFunctionMgrCtrl1.AppendWorking(working);
                    };
                    page.SetBindingData(project, projectSite, hydroInfo, allWorkingCheckedListDict);
                    CreatePage(page, guid);
@@ -112,7 +118,7 @@
        //显示项目站工况事件
        private void XhsProjectSimulationFunctionMgrCtrl1_ShowProjectSiteWorkingEvent
            (XhsProjectVmo project, XhsProjectSiteVmo projectSite, Yw.Model.HydroModelInfo hydroInfo, HydroWorkingVmo working, DevExpress.Utils.Svg.SvgImage svgImage)
            (XhsProjectVmo project, XhsProjectSiteVmo projectSite, Yw.Model.HydroModelInfo hydroInfo, HydroWorkingVmo working, SvgImage svgImage)
        {
            lock (_locker)
            {
@@ -126,11 +132,67 @@
                if (!IsExistPage(guid, true))
                {
                    var page = new XhsProjectSimulationWorkingPage();
                    page.UpdateWorkingEvent += (rhs) =>
                    {
                        this.simulationFunctionMgrCtrl1.UpdateWorking(rhs);
                    };
                    page.RemoveWorkingEvent += (rhs) =>
                    {
                        this.simulationFunctionMgrCtrl1.RemoveWorking(rhs);
                    };
                    page.PageTitle.HeaderSvgImage = svgImage;
                    page.SetBindingData(project, projectSite, hydroInfo, working);
                    CreatePage(page, guid);
                }
            }
        }
        //项目站工况更新事件
        private void XhsProjectSimulationFunctionMgrCtrl1_ProjectSiteWorkingUpdateEvent
            (XhsProjectVmo project, XhsProjectSiteVmo projectSite, Yw.Model.HydroModelInfo hydroInfo, 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 XhsProjectSimulationFunctionMgrCtrl1_ProjectSiteWorkingRemoveEvent
            (XhsProjectVmo project, XhsProjectSiteVmo projectSite, Yw.Model.HydroModelInfo hydroInfo, 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);
        }
        //项目站工况选择改变事件
@@ -158,18 +220,69 @@
        }
        //项目站方案创建事件
        private async void XhsProjectSimulationFunctionMgrCtrl1_CreateProjectSiteSchemeEvent
            (XhsProjectVmo project, XhsProjectSiteVmo projectSite, DevExpress.Utils.Svg.SvgImage svgImage)
        private void XhsProjectSimulationFunctionMgrCtrl1_CreateProjectSiteSchemeEvent
            (XhsProjectVmo project, XhsProjectSiteVmo projectSite, Yw.Model.HydroModelInfo hydroInfo, SvgImage svgImage)
        {
            WaitFormHelper.ShowWaitForm(this.FindForm(), "正在加载模型,请稍侯...");
            var dlg = new AddXhsSchemeDlg();
            await dlg.SetBindingData(project, projectSite, null);
            dlg.Shown += delegate { WaitFormHelper.HideWaitForm(this.FindForm()); };
            dlg.ReloadDataEvent += (rhs) =>
            {
                this.simulationFunctionMgrCtrl1.AppendScheme(rhs);
            };
            dlg.SetBindingData(project, projectSite, hydroInfo);
            dlg.ShowDialog();
        }
        //显示项目站方案事件
        private void XhsProjectSimulationFunctionMgrCtrl1_ShowProjectSiteSchemeEvent
            (XhsProjectVmo project, XhsProjectSiteVmo projectSite, XhsSchemeVmo scheme, Yw.Model.HydroModelInfo hydroInfo, Dictionary<HydroWorkingVmo, bool> dict, SvgImage svgImage)
        {
            lock (_locker)
            {
                var guid = new PageGuid()
                {
                    Modular = this.PageGuid.Modular,
                    MoudingType = eMoudingType.Tab,
                    Function = SimulationFunctionHelper.Scheme,
                    TagName = scheme.ID.ToString()
                };
                if (!IsExistPage(guid, true))
                {
                    var page = new XhsProjectSimulationSchemePage();
                    page.PageTitle.HeaderSvgImage = svgImage;
                    page.AppendWorkingEvent += (working) =>
                    {
                        this.simulationFunctionMgrCtrl1.AppendSchemeWorking(scheme, working);
                    };
                    page.SetBindingData(project, projectSite, scheme, hydroInfo, dict);
                    CreatePage(page, guid);
                }
            }
        }
        //显示项目站方案工况事件
        private void XhsProjectSimulationFunctionMgrCtrl1_ShowProjectSiteSchemeWorkingEvent
            (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 = working.ID.ToString()
                };
                if (!IsExistPage(guid, true))
                {
                    var page = new XhsProjectSimulationWorkingPage();
                    page.PageTitle.HeaderSvgImage = svgImage;
                    page.SetBindingData(project, projectSite, scheme, hydroInfo, working);
                    CreatePage(page, guid);
                }
            }
        }
        #endregion
@@ -405,7 +518,6 @@
                        docPnl.Show();
                    }
                    break;
                case eMoudingType.Tab:
                    {
                        this.tabbedView1.BeginUpdate();
@@ -424,7 +536,6 @@
                        this.tabbedView1.Controller.Activate(doc);
                    }
                    break;
                default: break;
            }
            page.InitialDataSource();