Exemplo n.º 1
0
        protected internal override void Close(InstallOptions options)
        {
            foreach (TreeNode webAppTreeNode in siteCollectionsTreeView.Nodes)
            {
                // Add the web application as a target
                if (webAppTreeNode.Checked)
                {
                    WebApplicationInfo webAppInfo = webAppTreeNode.Tag as WebApplicationInfo;
                    if (webAppInfo != null)
                    {
                        options.WebApplicationTargets.Add(webAppInfo.Application);

                        ExtendedTreeNode extendedWebAppTreeNode = webAppTreeNode as ExtendedTreeNode;
                        if (extendedWebAppTreeNode != null)
                        {
                            if (!extendedWebAppTreeNode.Populated)
                            {
                                // Add ALL site collections within the web app as targets
                                foreach (SPSite siteCollection in webAppInfo.Application.Sites)
                                {
                                    try
                                    {
                                        SiteLoc siteLoc = new SiteLoc(siteCollection);
                                        siteLoc.featureList.AddRange(_featureIds); // add all known features for now (be nice to let user choose)
                                        options.SiteCollectionTargets.Add(siteLoc);
                                    }
                                    finally
                                    {
                                        // guarantee SPSite is released ASAP even in face of exception
                                        siteCollection.Dispose();
                                    }
                                }
                            }
                            else
                            {
                                // Add the checked site collections within this web application as targets
                                foreach (TreeNode siteCollTreeNode in webAppTreeNode.Nodes)
                                {
                                    if (siteCollTreeNode.Checked)
                                    {
                                        SiteCollectionInfo siteCollInfo = siteCollTreeNode.Tag as SiteCollectionInfo;
                                        if (siteCollInfo != null)
                                        {
                                            SiteLoc siteLoc = new SiteLoc(siteCollInfo.SiteCollection);
                                            siteLoc.featureList.AddRange(_featureIds); // add all known features for now (be nice to let user choose)
                                            options.SiteCollectionTargets.Add(siteLoc);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        protected internal override void Close(InstallOptions options)
        {
            foreach (TreeNode webAppTreeNode in siteCollectionsTreeView.Nodes)
              {
            // Add the web application as a target
            if (webAppTreeNode.Checked)
            {
              WebApplicationInfo webAppInfo = webAppTreeNode.Tag as WebApplicationInfo;
              if (webAppInfo != null)
              {
            options.WebApplicationTargets.Add(webAppInfo.Application);

            ExtendedTreeNode extendedWebAppTreeNode = webAppTreeNode as ExtendedTreeNode;
            if (extendedWebAppTreeNode != null)
            {
              if (!extendedWebAppTreeNode.Populated)
              {
                // Add ALL site collections within the web app as targets
                foreach (SPSite siteCollection in webAppInfo.Application.Sites)
                {
                    try
                    {
                        SiteLoc siteLoc = new SiteLoc(siteCollection);
                        siteLoc.featureList.AddRange(_featureIds); // add all known features for now (be nice to let user choose)
                        options.SiteCollectionTargets.Add(siteLoc);
                    }
                    finally
                    {
                        // guarantee SPSite is released ASAP even in face of exception
                        siteCollection.Dispose();
                    }
                }
              }
              else
              {
                // Add the checked site collections within this web application as targets
                foreach (TreeNode siteCollTreeNode in webAppTreeNode.Nodes)
                {
                  if (siteCollTreeNode.Checked)
                  {
                    SiteCollectionInfo siteCollInfo = siteCollTreeNode.Tag as SiteCollectionInfo;
                    if (siteCollInfo != null)
                    {
                        SiteLoc siteLoc = new SiteLoc(siteCollInfo.SiteCollection);
                        siteLoc.featureList.AddRange(_featureIds); // add all known features for now (be nice to let user choose)
                        options.SiteCollectionTargets.Add(siteLoc);
                    }
                  }
                }
              }
            }
              }
            }
              }
        }