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;
                    }
                }
            }
        }
Beispiel #2
0
        void WebAppTreeNode_TreeNodePopulate(object sender, TreeViewCancelEventArgs e)
        {
            WebApplicationInfo webAppInfo = e.Node.Tag as WebApplicationInfo;

            if (webAppInfo != null)
            {
                if (webAppInfo.Application.Sites.Count >= SiteCollectionCountWarning)
                {
                    string msg = String.Format(FormattedSiteCollectionCountWarningMessage, webAppInfo.Application.Sites.Count);
                    if (MessageBox.Show(msg, "Large Number of Site Collections", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.Yes)
                    {
                        e.Cancel = true;
                    }
                }
                if (!e.Cancel)
                {
                    foreach (SPSite site in webAppInfo.Application.Sites)
                    {
                        try
                        {
                            SiteCollectionInfo siteCollInfo = new SiteCollectionInfo(site, false);
                            ExtendedTreeNode.AddNewExtendedTreeNode(e.Node.Nodes, siteCollInfo.ToString(), siteCollInfo);
                        }
                        finally
                        {
                            // guarantee SPSite is released ASAP even in face of exception
                            site.Dispose();
                        }
                    }
                }
            }
        }
 void WebAppTreeNode_TreeNodePopulate(object sender, TreeViewCancelEventArgs e)
 {
     WebApplicationInfo webAppInfo = e.Node.Tag as WebApplicationInfo;
       if (webAppInfo != null)
       {
     if (webAppInfo.Application.Sites.Count >= SiteCollectionCountWarning)
     {
       string msg = String.Format(FormattedSiteCollectionCountWarningMessage, webAppInfo.Application.Sites.Count);
       if (MessageBox.Show(msg, "Large Number of Site Collections", 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);
       }
     }
       }
 }