I had the need to modify a
SharedProject and remove some nodes from it, add groups and add new nodes to it. All by code.
One requirement was to clear all content from the AOT Project first and then add groups and the single nodes again.
There is a simple method provided by Microsoft in the class
ProjectNode.clear(), there is just one thing to take care of so it will work:
Lock the visual updates first and unlock them afterwards!
To let the code speak:
ProjectNode rootProjectNode = SysTreeNode::getSharedProject().AOTfindChild('MyProjectName'); rootProjectNode.lockUpdate(); rootProjectNode.clear(); rootProjectNode.unlockUpdate();
Without the lock before calling
clear() it simply won't clear the project content without any errors or messages!
This method prevents visual updates untilt
unlockUpdate() is called.
MSDN Reference: ProjectNode.lockUpdate()
This method removes all contents of a project. Only from the project, not from the AOT itself!
MSDN Reference: ProjectNode.clear()
This method enables visual updates again.
MSDN Reference: ProjectNode.unlockUpdate()
Subscribe to robsCode
Get the latest posts delivered right to your inbox