void WebAppTreeNode_TreeNodePopulate(object sender, TreeViewCancelEventArgs e) { WebApplicationInfo webAppInfo = e.Node.Tag as WebApplicationInfo; bool preCheck = (((webAppInfo.Application.IsAdministrationWebApplication || webAppInfo.IsSRP) && InstallConfiguration.SuggestDeploymentToCentralAdminWebApplication) || ((!(webAppInfo.Application.IsAdministrationWebApplication || webAppInfo.IsSRP)) && InstallConfiguration.SuggestDeploymentToAllContentWebApplications)); if (webAppInfo != null) { if (webAppInfo.Application.Sites.Count >= SiteCollectionCountWarning) { string msg = String.Format(res.ManySitesWarning, webAppInfo.Application.Sites.Count); if (MessageBox.Show(msg, res.ManySites, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.Yes) { e.Cancel = true; } } if (!e.Cancel) { foreach (SPSite site in webAppInfo.Application.Sites) { SiteCollectionInfo siteCollInfo = new SiteCollectionInfo(site, false); ExtendedTreeNode.AddNewExtendedTreeNode(e.Node.Nodes, siteCollInfo.ToString(), siteCollInfo).Checked = preCheck; } } } }
private void PopulateTreeViewForWebApps(TreeNodeCollection treeNodes, SPWebApplicationCollection webApps) { foreach (SPWebApplication application in webApps) { WebApplicationInfo webAppInfo = new WebApplicationInfo(application, false); ExtendedTreeNode webAppTreeNode = ExtendedTreeNode.AddNewExtendedTreeNode(treeNodes, webAppInfo.ToString(), true, webAppInfo); webAppTreeNode.Checked = (((application.IsAdministrationWebApplication || webAppInfo.IsSRP) && InstallConfiguration.SuggestDeploymentToCentralAdminWebApplication) || ((!(application.IsAdministrationWebApplication || webAppInfo.IsSRP)) && InstallConfiguration.SuggestDeploymentToAllContentWebApplications)); webAppTreeNode.TreeNodePopulate += new ExtendedTreeNode.TreeNodeEventHandler(WebAppTreeNode_TreeNodePopulate); } }