public void UnExecute() { StageView stage = MainForm.CurrentStage; Library lib = MainForm.CurrentLibrary; LibraryView libView = MainForm.CurrentLibraryView; for (int i = removedTreeNodes.Length - 1; i >= 0; i--) { LibraryTreeNode liv = removedTreeNodes[i]; lib.AddLibraryItem(liv.item); libView.InsertNode(liv, removedPaths[i], removedIndexes[i]); } // todo: need to readd bonds and snaps. for (int i = removedInstances.Length - 1; i >= 0; i--) { stage.AddInstance(removedInstances[i]); } libView.SelectNode(selectedNode); removedInstances = null; removedTreeNodes = null; removedPaths = null; removedIndexes = null; selectedNode = null; stage.InvalidateAll(); libView.RefreshCurrentNode(); }