qin
2025-03-21 b6da0632c9704414934df0817386976eca1548a2
WinFrmUI/HStation.WinFrmUI.Assets.Core/22-cooling/01-series/AssetsCoolingSeriesMgrTreeCtrl.cs
@@ -1,12 +1,9 @@
using DevExpress.Utils;
using DevExpress.Utils.Design;
using DevExpress.Utils.DragDrop;
using DevExpress.XtraEditors;
using DevExpress.XtraTreeList;
using DevExpress.XtraTreeList.Nodes;
using HStation.Vmo;
using System.ComponentModel;
using System.Windows.Media.Imaging;
using Yw;
namespace HStation.WinFrmUI
@@ -14,7 +11,7 @@
    public partial class AssetsCoolingSeriesMgrTreeCtrl : DevExpress.XtraEditors.XtraUserControl
    {
        /// <summary>
        ///
        ///
        /// </summary>
        public AssetsCoolingSeriesMgrTreeCtrl()
        {
@@ -26,7 +23,6 @@
            this.barBtnDelete.ItemClick += BarBtnDelete_ItemClick;
            this.barBtnInfo.ItemClick += BarBtnInfo_ItemClick;
        }
        /// <summary>
        /// 聚焦改变事件
@@ -55,6 +51,7 @@
            this.treeList1.ForceInitialize();
            this.treeList1.ExpandAll();
            overlay.Close();
            SetDragEnable(this.barCkDrag.Checked);
        }
        //全部展开
@@ -88,14 +85,10 @@
        private void treeList1_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
        {
            var vm = this.treeList1.GetDataRecordByNode(e.Node) as AssetsCoolingSeriesMgrViewModel;
            this.FocusedChangedEvent?.Invoke(vm.Vmo);
        }
        //拖拽排序
        private void barCkDrag_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            var be = this.behaviorManager1.GetBehavior<DevExpress.Utils.DragDrop.DragDropBehavior>(this.treeList1);
            be.Properties.AllowDrag = this.barCkDrag.Checked;
            if (vm != null)
            {
                this.FocusedChangedEvent?.Invoke(vm.Vmo);
            }
        }
        //刷新
@@ -114,6 +107,7 @@
            _calcHitInfo = this.treeList1.CalcHitInfo(e.Location);
            this.popupMenu1.ShowPopup(MousePosition);
        }
        private TreeListHitInfo _calcHitInfo = null;
        //右键菜单弹出前验证
@@ -393,9 +387,19 @@
            });
        }
        //拖拽排序
        private void barCkDrag_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            this.SetDragEnable(this.barCkDrag.Checked);
        }
        #endregion
        //设置拖动可用性
        private void SetDragEnable(bool allowDrag)
        {
            var be = this.behaviorManager1.GetBehavior<DevExpress.Utils.DragDrop.DragDropBehavior>(this.treeList1);
            be.Properties.AllowDrag = allowDrag;
        }
        #endregion 拖拽
    }
}