private void TVOrgs_AfterSelect(object sender, TreeViewEventArgs e) { var node = tvOrgs.SelectedNode; if (node.Tag?.ToString() == "Solution") { var solNode = (CrmTreeNode <CrmSolution>)node; var crmSol = (CrmSolution)solNode.Component; var org = crmSol.Organization; var service = org.Service; crmSol.LoadMeta(service); crmSol.Path = solNode.Text; if (solNode.Parent != null) { crmSol.Path = $"{solNode.Parent.Text}::{crmSol.Path}"; if (solNode.Parent.Parent != null) { crmSol.Path = $"{solNode.Parent.Parent.Text}::{crmSol.Path}"; if (solNode.Parent.Parent.Parent != null) { crmSol.Path = $"{solNode.Parent.Parent.Parent.Text}::{crmSol.Path}"; } } } var solExplorer = new SolutionExplorer(crmSol.Path, imageList1); crmSol.Tree = solExplorer.Tree; var controls = tabControlMain.Controls.Find(crmSol.UniqueName, false); if (controls.Length == 0) { solExplorer.Display(crmSol); tabControlMain.Controls.Add(solExplorer.Container); } tabControlMain.SelectTab(crmSol.UniqueName); } }