internal void refreshRootNode() { splitContainer.SelectNextControl((Control)splitContainer, true, true, true, true); treeView.BeginUpdate(); rootNode.Nodes.Clear(); foreach (string key in adminServerManager.adminServerList.Keys) { AdminServer adminServer = adminServerManager.adminServerList[key]; AdminServerNode adminServerNode = new AdminServerNode(adminServer, this); adminServerNode.init(uiObjFactory.getObj("adminServerNode"), key); foreach (string id in adminServerNode.toolStripItemList.Keys) { ToolStripMenuItem tSI = adminServerNode.toolStripItemList[id].ToObject <ToolStripMenuItem>(); tSI.Click += (sender, e) => MessageBox.Show(adminServer.serverName + ":" + adminServer.portNo); adminServerNode.ContextMenuStrip.Items.Add(tSI); } adminServerNode.ContextMenuStrip.ImageList = imageList; rootNode.Nodes.Add(adminServerNode); if (key == adminServerManager.lastServerKey) { treeView.SelectedNode = adminServerNode; adminServerNode.doSelect(); adminServerNode.Expand(); } } treeView.EndUpdate(); }