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); }
internal NodeAddress DeleteNode(NodeAddress na) { NodeAddress refNode = na.GetParent(); TreeViewMappingElement tvme = GetElement(refNode); refNode.AddLast(tvme.Delete(na.GetLast())); return(refNode); }
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()); } }
public void TreeView_NodeMouseLeftClick(TreeNodeMouseClickEventArgs e) { NodeAddress na = (NodeAddress)e.Node.Tag; labelTable.Text = na.GetLabelText(); switch (na.NodeType) { case NodeType.Category: case NodeType.Institution: ShowElement(na); break; case NodeType.Account: ShowElement(na.GetParent()); break; } }
public void ChangeActive(NodeAddress na) { if (dataGridViewAccounting.InvokeRequired) { DelegateTable d = new DelegateTable(ChangeActive); this.Invoke(d, new object[] { na }); } else { labelTable.Text = na.GetLabelText(); if (na.NodeType == NodeType.Account) { na = na.GetParent(); } dataGridViewAccounting.ShowElement(Data.GetElement(na), Data.Map.GetElement(na)); } }
internal void AddItem(NodeAddress nodeAddress, IAccountingElement iNewAcc) { TreeViewMappingElement elmt = GetElement(nodeAddress.GetParent()); TreeViewMappingElement newElmt = elmt.AddElement(nodeAddress.Address.Last(), TreeViewMappingElement.CreateElement(iNewAcc)); }