private void Desktop_NodeRemoved(object sender, NodeEventArgs e) { MyNode node = (e.Node as MyNodeView).Node; if (node == null) { return; } Target.RemoveChild(node); if (node is MyNodeGroup) { m_mainForm.CloseGraphLayout(node as MyNodeGroup); } else if (node is IScriptableNode) { m_mainForm.CloseTextEditor(node as IScriptableNode); } m_mainForm.CloseObservers(node); m_mainForm.RemoveFromDashboard(node); // End state saving suppression, we'll need to save one state after the node is removed. m_mainForm.SuppressStateSaving = false; m_mainForm.ProjectStateChanged("Node removed"); }