From 79364d2965451332f31e801556f9e5e91aeaa81a Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期一, 23 九月 2024 10:15:00 +0800 Subject: [PATCH] 3 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/04-scheme/XhsProjectSimulationSchemeMgrCtrl.cs | 77 +++++++++++++++++++++++++++++++------- 1 files changed, 62 insertions(+), 15 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 3b4211a..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,18 +11,54 @@ this.listBoxControl1.InitialDefaultSettings(30); } + /// <summary> + /// 椤圭洰绔欓�夋嫨鏀瑰彉浜嬩欢 + /// </summary> + public event Action<XhsProjectSiteVmo> ProjectSiteSelectedChangedEvent; + private long _projectId;//椤圭洰id - private List<HStation.Dto.XhsProjectSiteStdDto> _allProjectSiteList = null;//鎵�鏈夐」鐩珯鍒楄〃 - private List<HStation.Dto.XhsSchemeDto> _allSchemeList = null;//鎵�鏈夋柟妗堝垪琛� + private XhsProjectVmo _project = null;//椤圭洰 + private List<XhsProjectSiteVmo> _allProjectSiteList = null;//鎵�鏈夐」鐩珯鍒楄〃 + private List<HStation.Vmo.XhsSchemeVmo> _allSchemeList = null;//鎵�鏈夋柟妗堝垪琛� /// <summary> /// 缁戝畾鏁版嵁 /// </summary> - public async void SetBindingData(long projectId) + public async Task SetBindingData(long projectId) { - _allProjectSiteList = await new BLL.XhsProjectSiteStd().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