From 3f24b14f07ef82526b2e1d56cc808f226e91cbb9 Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期五, 20 十二月 2024 21:47:33 +0800 Subject: [PATCH] Merge branch 'master' of http://47.103.154.90:83/r/HStation/XHS.V1.0 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/01-home/01-project/HomeXhsProjectTreeListCtrl.cs | 89 +++++++++++++++++++++++++++++++++++--------- 1 files changed, 70 insertions(+), 19 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 10f8c8d..bec0b13 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 @@ -14,25 +14,70 @@ /// <summary> /// 閫夋嫨椤圭洰浜嬩欢 /// </summary> - public event Action<XhsProjectStdDto> SelectProjectEvent; - private List<HomeXhsProjectTreeViewModel> _allBindingList = null;//褰撳墠缁戝畾鍒楄〃 + 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 = new List<HomeXhsProjectTreeViewModel>();//褰撳墠缁戝畾鍒楄〃 /// <summary> /// 缁戝畾鏁版嵁 /// </summary> - public void SetBindingData(List<XhsProjectStdDto> allProjectList) + public async void SetBindingData(List<XhsProjectVmo> allProjectList) { _allBindingList = new List<HomeXhsProjectTreeViewModel>(); - foreach (var item in allProjectList) + if (allProjectList != null) { - var vm = new HomeXhsProjectTreeViewModel(item); - _allBindingList.Add(vm); + foreach (var item in allProjectList) + { + 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> /// 璁剧疆榛樿 @@ -89,17 +134,6 @@ this.treeList1.OptionsView.ShowTreeLines = this.barCkTreeLine.Checked ? DefaultBoolean.True : DefaultBoolean.False; } - //榧犳爣鐐瑰嚮 - private 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); - //} - } - //鑱氱劍鑺傜偣鏀瑰彉 private void treeList1_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e) { @@ -114,8 +148,25 @@ 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(); + } + + //鍙屽嚮浜嬩欢 + private void treeList1_DoubleClick(object sender, EventArgs e) + { + var vm = this.treeList1.GetCurrentViewModel(_allBindingList); + if (vm == null) + { + return; + } + JumpDirectEvent.Invoke(vm.Project.ID); + } } -} +} \ No newline at end of file -- Gitblit v1.9.3