From 046df0f7526575cfb8b4b8c045d864c498b5a46c Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期五, 06 十二月 2024 17:06:46 +0800 Subject: [PATCH] 项目Service优化,可见视图列表优化 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/XhsProjectSimulationMgrPage.cs | 396 +++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 318 insertions(+), 78 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/XhsProjectSimulationMgrPage.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/XhsProjectSimulationMgrPage.cs index 89066ad..37f5caf 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,23 +15,22 @@ 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 += 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; + this.simulationFunctionMgrCtrl1.ProjectSiteSchemeWorkingCheckedEvent += SimulationFunctionMgrCtrl1_ProjectSiteSchemeWorkingCheckedEvent; + this.simulationFunctionMgrCtrl1.ProjectSiteSchemeWorkingUpdateEvent += SimulationFunctionMgrCtrl1_ProjectSiteSchemeWorkingUpdateEvent; + this.simulationFunctionMgrCtrl1.ProjectSiteSchemeWorkingRemoveEvent += SimulationFunctionMgrCtrl1_ProjectSiteSchemeWorkingRemoveEvent; } - - 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();//閿佸畾瀵硅薄 - /// <summary> /// 鍒濆鍖栨暟鎹簮 @@ -41,40 +42,7 @@ { 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> @@ -101,8 +69,9 @@ #region 鍔熻兘闈㈡澘 - //鏄剧ず椤圭洰淇℃伅浜嬩欢 - private void XhsProjectSimulationFunctionMgrCtrl1_ShowProjectInfoEvent(DevExpress.Utils.Svg.SvgImage svgImage) + //鏄剧ず椤圭洰绔欐鍐典簨浠� + private void XhsProjectSimulationFunctionMgrCtrl1_ShowProjectSiteInfoEvent + (XhsProjectVmo project, XhsProjectSiteVmo projectSite, Yw.Model.HydroModelInfo hydroInfo, SvgImage svgImage) { lock (_locker) { @@ -116,14 +85,15 @@ { 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 XhsProjectSimulationFunctionMgrCtrl1_ShowProjectSiteSimulationEvent + (XhsProjectVmo project, XhsProjectSiteVmo projectSite, Yw.Model.HydroModelInfo hydroInfo, Dictionary<HydroWorkingVmo, bool> allWorkingCheckedListDict, SvgImage svgImage) { lock (_locker) { @@ -132,6 +102,7 @@ Modular = this.PageGuid.Modular, MoudingType = eMoudingType.Tab, Function = SimulationFunctionHelper.Simulation, + TagName = projectSite.ID.ToString() }; if (!IsExistPage(guid, true)) { @@ -139,51 +110,261 @@ page.PageTitle.HeaderSvgImage = svgImage; page.AppendWorkingEvent += (working) => { - _allWorkingList.Add(working); - this.xhsProjectSimulationFunctionMgrCtrl1.AppendWorking(working); + this.simulationFunctionMgrCtrl1.AppendWorking(working); }; - page.SetBindingData(_project, _projectSite, _allWorkingList); + page.SetBindingData(project, projectSite, hydroInfo, allWorkingCheckedListDict); CreatePage(page, guid); } } } - //鍒涘缓椤圭洰鏂规浜嬩欢 - private async void XhsProjectSimulationFunctionMgrCtrl1_CreateProjectSchemeEvent(DevExpress.Utils.Svg.SvgImage svgImage) + //鏄剧ず椤圭洰绔欏伐鍐典簨浠� + private void XhsProjectSimulationFunctionMgrCtrl1_ShowProjectSiteWorkingEvent + (XhsProjectVmo project, XhsProjectSiteVmo projectSite, 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 = working.ID.ToString() + }; + 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 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 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); + } + + //椤圭洰绔欏伐鍐甸�夋嫨鏀瑰彉浜嬩欢 + private void XhsProjectSimulationFunctionMgrCtrl1_ProjectSiteWorkingCheckedEvent + (XhsProjectVmo project, XhsProjectSiteVmo projectSite, Yw.Model.HydroModelInfo hydroInfo, 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 XhsProjectSimulationFunctionMgrCtrl1_CreateProjectSiteSchemeEvent + (XhsProjectVmo project, XhsProjectSiteVmo projectSite, Yw.Model.HydroModelInfo hydroInfo, SvgImage svgImage) + { + 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(); } - private void XhsProjectSimulationFunctionMgrCtrl1_ShowProjectSchemeEvent(XhsSchemeVmo arg1, DevExpress.Utils.Svg.SvgImage arg2) + //鏄剧ず椤圭洰绔欐柟妗堜簨浠� + private void XhsProjectSimulationFunctionMgrCtrl1_ShowProjectSiteSchemeEvent + (XhsProjectVmo project, XhsProjectSiteVmo projectSite, XhsSchemeVmo scheme, Yw.Model.HydroModelInfo hydroInfo, Dictionary<HydroWorkingVmo, bool> dict, SvgImage svgImage) { - throw new NotImplementedException(); + 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_CompareProjectWorkingEvent(DevExpress.Utils.Svg.SvgImage obj) + //鏄剧ず椤圭洰绔欐柟妗堝伐鍐典簨浠� + private void XhsProjectSimulationFunctionMgrCtrl1_ShowProjectSiteSchemeWorkingEvent + (XhsProjectVmo project, XhsProjectSiteVmo projectSite, XhsSchemeVmo scheme, Yw.Model.HydroModelInfo hydroInfo, HydroWorkingVmo working, SvgImage svgImage) { - throw new NotImplementedException(); + 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.UpdateWorkingEvent += (rhs) => + { + this.simulationFunctionMgrCtrl1.UpdateSchemeWorking(scheme, rhs); + }; + page.RemoveWorkingEvent += (rhs) => + { + this.simulationFunctionMgrCtrl1.RemoveSchemeWorking(scheme, rhs); + }; + page.SetBindingData(project, projectSite, scheme, hydroInfo, working); + CreatePage(page, guid); + } + } } - private void XhsProjectSimulationFunctionMgrCtrl1_ShowProjectWorkingEvent(HydroWorkingVmo arg1, DevExpress.Utils.Svg.SvgImage arg2) + //椤圭洰绔欐柟妗堝伐鍐甸�夋嫨鏀瑰彉浜嬩欢 + private void SimulationFunctionMgrCtrl1_ProjectSiteSchemeWorkingCheckedEvent(XhsSchemeVmo scheme, HydroWorkingVmo working, bool hasChecked) { - throw new NotImplementedException(); + var guid = new PageGuid() + { + Modular = this.PageGuid.Modular, + MoudingType = eMoudingType.Tab, + Function = SimulationFunctionHelper.Scheme, + TagName = scheme.ID.ToString() + }; + var page = FindPage(guid); + if (page == null) + { + return; + } + var ctrl = page as XhsProjectSimulationSchemePage; + if (ctrl == null) + { + return; + } + ctrl.UpdateWorkingCheckedList(working, hasChecked); } - #endregion 鍔熻兘闈㈡澘 + //椤圭洰绔欐柟妗堝伐鍐垫洿鏂颁簨浠� + private void SimulationFunctionMgrCtrl1_ProjectSiteSchemeWorkingUpdateEvent(XhsSchemeVmo scheme, HydroWorkingVmo working) + { + var guid = new PageGuid() + { + Modular = this.PageGuid.Modular, + MoudingType = eMoudingType.Tab, + Function = SimulationFunctionHelper.Scheme, + TagName = scheme.ID.ToString() + }; + var page = FindPage(guid); + if (page == null) + { + return; + } + var ctrl = page as XhsProjectSimulationSchemePage; + if (ctrl == null) + { + return; + } + + } + + //椤圭洰绔欐柟妗堝伐鍐电Щ闄や簨浠� + private void SimulationFunctionMgrCtrl1_ProjectSiteSchemeWorkingRemoveEvent(XhsSchemeVmo scheme, HydroWorkingVmo working) + { + var guid = new PageGuid() + { + Modular = this.PageGuid.Modular, + MoudingType = eMoudingType.Tab, + Function = SimulationFunctionHelper.Scheme, + TagName = scheme.ID.ToString() + }; + var page = FindPage(guid); + if (page == null) + { + return; + } + var ctrl = page as XhsProjectSimulationSchemePage; + if (ctrl == null) + { + return; + } + + } + + + #endregion #region TabbedView 鐩稿叧浜嬩欢澶勭悊绋嬪簭 @@ -210,12 +391,28 @@ return; } + //姝e湪鍏抽棴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 @@ -401,7 +598,6 @@ docPnl.Show(); } break; - case eMoudingType.Tab: { this.tabbedView1.BeginUpdate(); @@ -420,7 +616,6 @@ this.tabbedView1.Controller.Activate(doc); } break; - default: break; } page.InitialDataSource(); @@ -464,7 +659,52 @@ } } - #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 } } \ No newline at end of file -- Gitblit v1.9.3