From e4f7633712f12fed7f6477a4316e1ba5d7b4c33e Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期六, 14 九月 2024 10:17:09 +0800 Subject: [PATCH] 水力模拟界面基本框提交 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/04-scheme/XhsProjectSimulationSchemeMgrCtrl.cs | 73 ++++++++++++++++++++++++++++++------ 1 files changed, 60 insertions(+), 13 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/04-scheme/XhsProjectSimulationSchemeMgrCtrl.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/04-scheme/XhsProjectSimulationSchemeMgrCtrl.cs index fc04312..afdd1af 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/04-scheme/XhsProjectSimulationSchemeMgrCtrl.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/04-scheme/XhsProjectSimulationSchemeMgrCtrl.cs @@ -1,4 +1,6 @@ -锘縩amespace HStation.WinFrmUI +锘縰sing HStation.Vmo; + +namespace HStation.WinFrmUI { public partial class XhsProjectSimulationSchemeMgrCtrl : DevExpress.XtraEditors.XtraUserControl { @@ -9,8 +11,14 @@ this.listBoxControl1.InitialDefaultSettings(30); } + /// <summary> + /// 椤圭洰绔欓�夋嫨鏀瑰彉浜嬩欢 + /// </summary> + public event Action<XhsProjectSiteVmo> ProjectSiteSelectedChangedEvent; + private long _projectId;//椤圭洰id - private List<HStation.Vmo.XhsProjectSiteVmo> _allProjectSiteList = null;//鎵�鏈夐」鐩珯鍒楄〃 + private XhsProjectVmo _project = null;//椤圭洰 + private List<XhsProjectSiteVmo> _allProjectSiteList = null;//鎵�鏈夐」鐩珯鍒楄〃 private List<HStation.Vmo.XhsSchemeVmo> _allSchemeList = null;//鎵�鏈夋柟妗堝垪琛� @@ -19,8 +27,38 @@ /// </summary> public async Task SetBindingData(long projectId) { - _allProjectSiteList = await BLLFactory<HStation.BLL.XhsProjectSite>.Instance.GetByProjectID(projectId); + _projectId = projectId; + _project = await BLLFactory<HStation.BLL.XhsProject>.Instance.GetByID(projectId); + await SetBindingData(_project); + } + + /// <summary> + /// 缁戝畾鏁版嵁 + /// </summary> + public async Task SetBindingData(XhsProjectVmo project) + { + if (project == null) + { + return; + } + _project = project; + _projectId = project.ID; + _allProjectSiteList = await BLLFactory<HStation.BLL.XhsProjectSite>.Instance.GetByProjectID(_projectId); InitialProjectSiteList(); + } + + /// <summary> + /// 娣诲姞鏂规 + /// </summary> + public void AppendScheme(XhsSchemeVmo scheme) + { + if (_allSchemeList == null) + { + _allSchemeList = new List<XhsSchemeVmo>(); + } + _allSchemeList.Add(scheme); + this.xhsProjectSimulationSchemeMgrViewModelBindingSource.DataSource = _allSchemeList; + this.xhsProjectSimulationSchemeMgrViewModelBindingSource.ResetBindings(false); } //鍒濆鍖栭」鐩珯鍒楄〃 @@ -39,7 +77,12 @@ } } this.imgCmbProjectSiteList.Properties.EndUpdate(); - this.imgCmbProjectSiteList.SelectedIndex = 0; + + if (_allProjectSiteList != null && _allProjectSiteList.Count > 0) + { + this.imgCmbProjectSiteList.SelectedIndex = 0; + } + if (_allProjectSiteList != null && _allProjectSiteList.Count > 1) { this.itemForProjectSiteList.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; @@ -50,22 +93,26 @@ } } - //椤圭洰绔欓�夋嫨绱㈠紩鏀瑰彉 - private void imgCmbProjectSiteList_SelectedIndexChanged(object sender, EventArgs e) + //鍒濆鍖栭」鐩柟妗� + private async Task InitalSchemeList(XhsProjectSiteVmo projectSite) { - var item = this.imgCmbProjectSiteList.SelectedItem as XhsProjectStdDto; - if (item == null) + _allSchemeList = null; + if (projectSite != null) { - return; + _allSchemeList = await BLLFactory<HStation.BLL.XhsScheme>.Instance.GetBySiteID(projectSite.ID); } - + this.xhsProjectSimulationSchemeMgrViewModelBindingSource.DataSource = _allSchemeList; + this.xhsProjectSimulationSchemeMgrViewModelBindingSource.ResetBindings(false); } - //椤圭洰绔欓�夋嫨鍊兼敼鍙� - private void imgCmbProjectSiteList_SelectedValueChanged(object sender, EventArgs e) + //椤圭洰绔欓�夋嫨绱㈠紩鏀瑰彉 + private async void imgCmbProjectSiteList_SelectedIndexChanged(object sender, EventArgs e) { - + var vmo = this.imgCmbProjectSiteList.EditValue as XhsProjectSiteVmo; + await InitalSchemeList(vmo); + this.ProjectSiteSelectedChangedEvent?.Invoke(vmo); } + } } -- Gitblit v1.9.3