From 4607e20cecf567ee2e86f9a07158deaa1b74d622 Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期一, 09 十二月 2024 15:05:19 +0800 Subject: [PATCH] 方案修改 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/08-working/XhsProjectSimulationWorkingPage.cs | 121 ++++++++++++++++++++++++++++------------ 1 files changed, 84 insertions(+), 37 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/08-working/XhsProjectSimulationWorkingPage.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/08-working/XhsProjectSimulationWorkingPage.cs index 6e70e31..c20af2b 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/08-working/XhsProjectSimulationWorkingPage.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/08-working/XhsProjectSimulationWorkingPage.cs @@ -9,6 +9,7 @@ using Yw.WinFrmUI.Q3d; using Yw.EPAnet; using Mapster; +using Microsoft.CodeAnalysis.CSharp.Syntax; namespace HStation.WinFrmUI { public partial class XhsProjectSimulationWorkingPage : DocumentPage @@ -18,32 +19,24 @@ InitializeComponent(); this.PageTitle.Caption = "姘村姏妯℃嫙宸ュ喌"; this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + } + + + /// <summary> + /// 鏇存柊宸ュ喌浜嬩欢 + /// </summary> + public event Action<HydroWorkingVmo> UpdateWorkingEvent; + /// <summary> + /// 绉婚櫎宸ュ喌浜嬩欢 + /// </summary> + public event Action<HydroWorkingVmo> RemoveWorkingEvent; private HStation.Vmo.XhsProjectVmo _project = null;//椤圭洰 private HStation.Vmo.XhsProjectSiteVmo _projectSite = null;//椤圭洰绔� private XhsSchemeVmo _scheme = null;//鏂规 private Yw.Model.HydroModelInfo _hydroInfo = null;//姘村姏淇℃伅 private HydroWorkingVmo _working = null;//宸ュ喌 - - /// <summary> - /// 缁戝畾鏁版嵁 - /// </summary> - public void SetBindingData - ( - XhsProjectVmo project, - XhsProjectSiteVmo projectSite, - Yw.Model.HydroModelInfo hydroInfo, - HydroWorkingVmo working - ) - { - _project = project; - _projectSite = projectSite; - _hydroInfo = hydroInfo.Adapt<Yw.Model.HydroModelInfo>(); - _working = working; - _hydroInfo.UpdateWorkingInfo(_working.WorkingInfo); - this.PageTitle.Caption = $"姘村姏妯℃嫙\r\n{_working.Name}"; - } /// <summary> /// 缁戝畾鏁版嵁 @@ -63,7 +56,14 @@ _hydroInfo = hydroInfo.Adapt<Yw.Model.HydroModelInfo>(); _working = working; _hydroInfo.UpdateWorkingInfo(_working.WorkingInfo); - this.PageTitle.Caption = $"{scheme.Name}\r\n{_working.Name}"; + if (_scheme == null) + { + this.PageTitle.Caption = $"姘村姏妯℃嫙\r\n{_working.Name}"; + } + else + { + this.PageTitle.Caption = $"{scheme.Name}\r\n{_working.Name}"; + } } /// <summary> @@ -80,10 +80,10 @@ #region BIM鎺т欢 //bimface鎺т欢 - private XhsProjectSimulationBimfaceCtrl _bimfaceCtrl = null; + private SimulationBimfaceCtrl _bimfaceCtrl = null; //鑾峰彇 bimface 鎺т欢 - private async Task<XhsProjectSimulationBimfaceCtrl> GetBimfaceCtrl() + private async Task<SimulationBimfaceCtrl> GetBimfaceCtrl() { if (_hydroInfo == null) { @@ -91,7 +91,7 @@ } if (_bimfaceCtrl == null) { - _bimfaceCtrl = new XhsProjectSimulationBimfaceCtrl(); + _bimfaceCtrl = new SimulationBimfaceCtrl(); _bimfaceCtrl.Dock = DockStyle.Fill; await _bimfaceCtrl.InitialData(_project, _projectSite); _bimfaceCtrl.LoadCompletedEvent += async () => @@ -167,10 +167,10 @@ #region 灞炴�ф帶浠� //灞炴�ф帶浠� - private HydroVisualPropertyViewCtrl _propertyCtrl = null; + private SimulationPropertyCtrl _propertyCtrl = null; //鑾峰彇灞炴�ф帶浠� - private HydroVisualPropertyViewCtrl GetPropertyCtrl() + private SimulationPropertyCtrl GetPropertyCtrl() { if (_hydroInfo == null) { @@ -178,11 +178,12 @@ } if (_propertyCtrl == null) { - _propertyCtrl = new HydroVisualPropertyViewCtrl(); + _propertyCtrl = new SimulationPropertyCtrl(); _propertyCtrl.Dock = DockStyle.Fill; - _propertyCtrl.HydroViewEvent += (visualViewModel) => + _propertyCtrl.AllowEdit = false; + _propertyCtrl.HydroViewEvent += (visual) => { - SelectVisual(GetVisual(visualViewModel), eVisualSource.Property); + SelectVisual(visual, eVisualSource.Property); }; _propertyCtrl.BlinkLinkNodeEvent += async (link, linkNodeCode) => { //寮鸿皟杩炴帴鑺傜偣 @@ -234,7 +235,7 @@ { if (this.controlContainerRight.Controls.Count > 0) { - if (this.controlContainerRight.Controls[0] is XhsProjectSimulationPropertyCtrl) + if (this.controlContainerRight.Controls[0] is SimulationPropertyCtrl) { return true; } @@ -274,14 +275,6 @@ _propertyCtrl?.UpdateRows(); } - //娓呯悊灞炴�ф帶浠� - private void ClearPropertyCtrl() - { - if (_propertyCtrl != null) - { - _propertyCtrl.SelectedObject = null; - } - } #endregion @@ -1712,9 +1705,63 @@ #endregion + #region 鏇存柊宸ュ喌 + //缂栬緫 + private void barBtnEdit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + if (_hydroInfo == null) + { + return; + } + if (_working == null) + { + return; + } + var dlg = new EditHydroWorkingDlg(); + dlg.SetBindingData(_working); + dlg.ReloadDataEvent += (rhs) => + { + _working = rhs; + this.PageTitle.Caption = $"姘村姏妯℃嫙\r\n{_working.Name}"; + UpdatePageTitle(this.PageGuid, this.PageTitle); + this.UpdateWorkingEvent?.Invoke(_working); + }; + dlg.ShowDialog(); + } + #endregion + #region 鍒犻櫎宸ュ喌 + + //鍒犻櫎 + private async void barBtnDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + if (_hydroInfo == null) + { + return; + } + if (_working == null) + { + return; + } + var bol = XtraMessageBox.Show("璇烽棶鏄惁鍒犻櫎褰撳墠宸ュ喌锛�", "璇㈤棶", MessageBoxButtons.YesNo) == DialogResult.Yes; + if (!bol) + { + return; + } + bol = await BLLFactory<Yw.BLL.HydroWorking>.Instance.DeleteByID(_working.ID); + if (!bol) + { + TipFormHelper.ShowError("鍒犻櫎澶辫触锛�"); + return; + } + this.RemoveWorkingEvent?.Invoke(_working); + TipFormHelper.ShowSucceed("鍒犻櫎鎴愬姛锛�"); + ClosePage(this.PageGuid); + } + + #endregion } -- Gitblit v1.9.3