public bool AddSlotOrDomainValueNode(ViewModelFramesHierarchy parentNode) { switch (parentNode.kbEntity) { case KBEntity.DEFAULT_ENTITY: if (parentNode.Name == "Фреймы") { PrependFrame(); } else if (parentNode.Name == "Домены") { PrependDomain(); } break; case KBEntity.FRAME: int slotsCount = parentNode.Nodes.Count - 1; Slot newSlotName_Slot = new Slot() { name = "!!!newSlotName " + _newSlotNameCounter++.ToString(), value = null, }; parentNode.Frame.slots.Add(newSlotName_Slot); //TODO: Нужно сделать с нормальной проверкой: MainFrameContainer.ReplaceFrame(parentNode.frame.name, parentNode.frame); ViewModelFramesHierarchy newSlotName_Node = new ViewModelFramesHierarchy() { kbEntity = KBEntity.SLOT_NAME, ParentalNode = parentNode, NodeIndex = slotsCount + 1, Name = newSlotName_Slot.name, }; parentNode.Nodes.Add(newSlotName_Node); UpdateDomainNodes(); /////////////// break; case KBEntity.SLOT_NAME: if (parentNode.Nodes.Count == 0) { int slotIndex = parentNode.NodeIndex - 1; Frame parentFrame = parentNode.ParentalNode.frame; parentFrame.slots[slotIndex].value = "!!!newSlotValue "; //TODO: Нужно сделать с нормальной проверкой: MainFrameContainer.ReplaceFrame(parentFrame.name, parentFrame); ViewModelFramesHierarchy newSlotValue_Node = new ViewModelFramesHierarchy() { kbEntity = KBEntity.SLOT_VALUE, ParentalNode = parentNode, Name = parentFrame.slots[slotIndex].value, }; parentNode.Nodes.Add(newSlotValue_Node); UpdateDomainNodes(); viewModelGraph.DrawAllKB(MainFrameContainer); break; } break; case KBEntity.DOMAIN_NAME: int domainsCount = parentNode.Nodes.Count - 1; string newDomain_ValueName = "!!!newDomainValue " + _newDomainValueCounter++.ToString(); if (MainFrameContainer.AddNewValueToDomain(parentNode.Domain.name, newDomain_ValueName)) { parentNode.Domain.values.Add(newDomain_ValueName); ViewModelFramesHierarchy newDomainValue_Node = new ViewModelFramesHierarchy() { kbEntity = KBEntity.DOMAIN_VALUE, ParentalNode = parentNode, NodeIndex = domainsCount + 1, Name = newDomain_ValueName, }; parentNode.Nodes.Add(newDomainValue_Node); } break; default: break; } OnPropertyChanged("AddSlotOrDomainValueNode"); return(true); }