Esempio n. 1
0
        public bool LoadServer(ContextMenuStrip poolsMenu, ContextMenuStrip sitesMenu, ContextMenuStrip siteMenu)
        {
            PoolsNode = new ApplicationPoolsTreeNode(ServiceProvider, ServerManager.ApplicationPools, this)
            {
                ContextMenuStrip = poolsMenu
            };
            Nodes.Add(PoolsNode);
            SitesNode = new SitesTreeNode(ServiceProvider, ServerManager.Sites, this)
            {
                ContextMenuStrip = sitesMenu
            };
            Nodes.Add(SitesNode);
            TreeView.SelectedNode = this;

            foreach (Site site in ServerManager.Sites)
            {
                var siteNode = new SiteTreeNode(ServiceProvider, site, this)
                {
                    ContextMenuStrip = siteMenu
                };
                SitesNode.Nodes.Add(siteNode);
            }

            // TODO: re-enable web farm support.
            //data.FarmNode = data.ServerNode.Nodes.Add("Server Farms");
            //data.FarmNode.ContextMenuStrip = cmsFarm;
            //data.FarmNode.ImageIndex = 7;
            //data.FarmNode.SelectedImageIndex = 7;
            //data.FarmNode.Tag = data.Server;

            return(true);
        }
        public bool LoadServer(ContextMenuStrip poolsMenu, ContextMenuStrip sitesMenu, ContextMenuStrip siteMenu)
        {
            if (readOnly)
            {
                MessageBox.Show("Elevation is required. Please run Jexus Manager as administrator.");
                return(false);
            }

            if (ServerManager == null)
            {
                return(false);
            }

            try
            {
                PoolsNode = new ApplicationPoolsTreeNode(ServiceProvider, ServerManager.ApplicationPools, this)
                {
                    ContextMenuStrip = poolsMenu
                };
                Nodes.Add(PoolsNode);
            }
            catch (Exception)
            {
                return(false);
            }

            SitesNode = new SitesTreeNode(ServiceProvider, ServerManager.Sites, this)
            {
                ContextMenuStrip = sitesMenu
            };
            Nodes.Add(SitesNode);
            TreeView.SelectedNode = this;

            foreach (Site site in ServerManager.Sites)
            {
                var siteNode = new SiteTreeNode(ServiceProvider, site, this)
                {
                    ContextMenuStrip = siteMenu
                };
                SitesNode.Nodes.Add(siteNode);
            }

            // TODO: re-enable web farm support.
            //data.FarmNode = data.ServerNode.Nodes.Add("Server Farms");
            //data.FarmNode.ContextMenuStrip = cmsFarm;
            //data.FarmNode.ImageIndex = 7;
            //data.FarmNode.SelectedImageIndex = 7;
            //data.FarmNode.Tag = data.Server;

            return(true);
        }