Beispiel #1
0
        public NodeAddress DeleteItem(NodeAddress na)
        {
            NodeAddress res;

            if (na.NodeType == NodeType.Category)
            {
                if (_Data.Count > 1)
                {
                    _Data.Remove(GetCategory(na.Address[0]));
                    res = _Map.DeleteNode(na);
                }
                else
                {
                    res = na;
                }
            }
            else
            {
                GetElement(na.GetParent()).Delete(na.GetLast());
                res = _Map.DeleteNode(na);
            }
            if (res.IsEqual(na))
            {
                MessageBox.Show($"You cannot delete {na.GetLast()} as it is the last element of [{na.GetParent().GetLabelText()}]!");
            }
            return(res);
        }
        public void MoveNode(NodeAddress draggedNode, NodeAddress refNode)
        {
            NodeAddress parent = draggedNode.GetParent();

            if (parent.IsEqual(refNode.GetParent()))
            {
                TreeViewMappingElement tvme = GetElement(parent);
                tvme.MoveNode(draggedNode.GetLast(), refNode.GetLast());
            }
            if (parent.IsEqual(refNode))
            {
                TreeViewMappingElement tvme = GetElement(parent);
                tvme.MoveNode(draggedNode.GetLast());
            }
        }
        internal NodeAddress DeleteNode(NodeAddress na)
        {
            NodeAddress            refNode = na.GetParent();
            TreeViewMappingElement tvme    = GetElement(refNode);

            refNode.AddLast(tvme.Delete(na.GetLast()));
            return(refNode);
        }