From 93bc151189c3956c80701bf1adf7600be6f19ee7 Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期三, 23 十月 2024 16:19:13 +0800 Subject: [PATCH] 颜色分级 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/01-home/01-project/HomeXhsProjectTreeListCtrl.cs | 83 +++++++++++++++++++++++++++++++++++------ 1 files changed, 71 insertions(+), 12 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/01-home/01-project/HomeXhsProjectTreeListCtrl.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/01-home/01-project/HomeXhsProjectTreeListCtrl.cs index fb5f588..eece155 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/01-home/01-project/HomeXhsProjectTreeListCtrl.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/01-home/01-project/HomeXhsProjectTreeListCtrl.cs @@ -1,4 +1,7 @@ 锘縰sing DevExpress.Utils; +using HStation.Vmo; +using NetTaste; +using Yw.WinFrmUI.Page; namespace HStation.WinFrmUI { @@ -9,31 +12,75 @@ InitializeComponent(); this.treeList1.InitialDefaultSettings(); this.layoutControl1.SetupLayoutControl(); + this.treeList1.SelectImageList = imageCollection1; } /// <summary> /// 閫夋嫨椤圭洰浜嬩欢 /// </summary> - public event Action<XhsProjectStdDto> SelectProjectEvent; + public event Action<XhsProjectVmo> SelectProjectEvent; + + /// <summary> + /// 鍒锋柊鏁版嵁浜嬩欢 + /// </summary> + public event Action RefreshDataEvent; + + public event Action<long> JumpDirectEvent; + + /// <summary> + /// 椤圭洰瀵煎叆瀹屾垚浜嬩欢 + /// </summary> + public event Action<ImportXhsProjectViewModel> ImportProjectCompletedEvent; private List<HomeXhsProjectTreeViewModel> _allBindingList = null;//褰撳墠缁戝畾鍒楄〃 /// <summary> /// 缁戝畾鏁版嵁 /// </summary> - public void SetBindingData(List<XhsProjectStdDto> allProjectList) + public async void SetBindingData(List<XhsProjectVmo> allProjectList) { _allBindingList = new List<HomeXhsProjectTreeViewModel>(); + if (allProjectList == null) + return; foreach (var item in allProjectList) { - var vm = new HomeXhsProjectTreeViewModel(item); - _allBindingList.Add(vm); + if (await IsHaveBimFace(item.ID)) + { + var vm = new HomeXhsProjectTreeViewModel(item, true); + _allBindingList.Add(vm); + } + else + { + var vm = new HomeXhsProjectTreeViewModel(item, false); + _allBindingList.Add(vm); + } } this.treeList1.DataSource = _allBindingList; this.treeList1.ForceInitialize(); this.treeList1.ExpandAll(); } + //鏌ユ壘椤圭洰鏄惁瀛樺湪妯″瀷 + private async Task<bool> IsHaveBimFace(long ProjectID) + { + var projectSite = await BLLFactory<HStation.BLL.XhsProjectSite>.Instance.GetDefaultByProjectID(ProjectID); + if (projectSite == null) + { + return false; + } + var relation = await BLLFactory<Yw.BLL.BimfaceFileRelation>.Instance + .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, projectSite.ID, Yw.Bimface.Purpose.Simulation); + if (relation == null) + { + return false; + } + var bimfaceFile = await BLLFactory<Yw.BLL.BimfaceFile>.Instance.GetByID(relation.BimfaceFileID); + if (bimfaceFile == null) + { + return false; + } + return true; + } /// <summary> /// 璁剧疆榛樿 @@ -91,13 +138,18 @@ } //榧犳爣鐐瑰嚮 - private void treeList1_RowCellClick(object sender, DevExpress.XtraTreeList.RowCellClickEventArgs e) + private async void treeList1_RowCellClick(object sender, DevExpress.XtraTreeList.RowCellClickEventArgs e) { - //if (e.Button == MouseButtons.Left) - //{ - // var vm = this.treeList1.GetDataRecordByNode(e.Node) as HomeXhsProjectTreeViewModel; - // this.SelectProjectEvent?.Invoke(vm.Project); - //} + if (_allBindingList == null || _allBindingList.Count < 1) + return; + var vm = this.treeList1.GetCurrentViewModel(_allBindingList); + if (vm == null) + { + return; + } + if (e.Column != this.colJump) + return; + JumpDirectEvent.Invoke(vm.Project.ID); } //鑱氱劍鑺傜偣鏀瑰彉 @@ -111,10 +163,17 @@ private void btnImportProject_Click(object sender, EventArgs e) { var dlg = new ImportXhsProjectDlg(); + dlg.SetBindingData(); if (dlg.ShowDialog() == DialogResult.OK) { - + this.ImportProjectCompletedEvent?.Invoke(dlg.ViewModel); } } + + //鍒锋柊 + private void barBtnRefresh_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + this.RefreshDataEvent?.Invoke(); + } } -} +} \ No newline at end of file -- Gitblit v1.9.3