Ejemplo n.º 1
0
        protected override void RenderVerbs(HtmlTextWriter writer)
        {
            int         num                 = 0;
            bool        enabled             = false;
            CatalogPart selectedCatalogPart = this.SelectedCatalogPart;

            if (selectedCatalogPart != null)
            {
                WebPartDescriptionCollection availableWebPartDescriptions = selectedCatalogPart.GetAvailableWebPartDescriptions();
                num = (availableWebPartDescriptions != null) ? availableWebPartDescriptions.Count : 0;
            }
            if (num == 0)
            {
                enabled = this.AddVerb.Enabled;
                this.AddVerb.Enabled = false;
            }
            try
            {
                base.RenderVerbsInternal(writer, new WebPartVerb[] { this.AddVerb, this.CloseVerb });
            }
            finally
            {
                if (num == 0)
                {
                    this.AddVerb.Enabled = enabled;
                }
            }
        }
Ejemplo n.º 2
0
        private void AddSelectedWebParts()
        {
            WebPartZoneBase zone = null;

            if (base.WebPartManager != null)
            {
                zone = base.WebPartManager.Zones[this._selectedZoneID];
            }
            CatalogPart selectedCatalogPart = this.SelectedCatalogPart;
            WebPartDescriptionCollection availableWebPartDescriptions = null;

            if (selectedCatalogPart != null)
            {
                availableWebPartDescriptions = selectedCatalogPart.GetAvailableWebPartDescriptions();
            }
            if (((zone != null) && zone.AllowLayoutChange) && ((this._selectedCheckBoxValues != null) && (availableWebPartDescriptions != null)))
            {
                ArrayList webParts = new ArrayList();
                for (int i = 0; i < this._selectedCheckBoxValues.Length; i++)
                {
                    string             str         = this._selectedCheckBoxValues[i];
                    WebPartDescription description = availableWebPartDescriptions[str];
                    if (description != null)
                    {
                        WebPart webPart = selectedCatalogPart.GetWebPart(description);
                        if (webPart != null)
                        {
                            webParts.Add(webPart);
                        }
                    }
                }
                this.AddWebParts(webParts, zone);
            }
        }
Ejemplo n.º 3
0
        protected override void RenderVerbs(HtmlTextWriter writer)
        {
            int  count = 0;
            bool originalAddVerbEnabled = false;

            CatalogPart selectedCatalogPart = SelectedCatalogPart;

            if (selectedCatalogPart != null)
            {
                WebPartDescriptionCollection availableWebParts = selectedCatalogPart.GetAvailableWebPartDescriptions();
                count = ((availableWebParts != null) ? availableWebParts.Count : 0);
            }

            // If the current CatalogPart has no WebPartDescriptions, disable the AddVerb
            if (count == 0)
            {
                originalAddVerbEnabled = AddVerb.Enabled;
                AddVerb.Enabled        = false;
            }

            try {
                RenderVerbsInternal(writer, new WebPartVerb[] { AddVerb, CloseVerb });
            }
            finally {
                if (count == 0)
                {
                    AddVerb.Enabled = originalAddVerbEnabled;
                }
            }
        }
Ejemplo n.º 4
0
        private void RenderItems(HtmlTextWriter writer, CatalogPart catalogPart)
        {
            WebPartDescriptionCollection availableWebParts = catalogPart.GetAvailableWebPartDescriptions();

            if (availableWebParts != null)
            {
                foreach (WebPartDescription webPartDescription in availableWebParts)
                {
                    RenderItem(writer, webPartDescription);
                }
            }
        }
Ejemplo n.º 5
0
        private void AddSelectedWebParts()
        {
            WebPartZoneBase selectedZone = null;

            if (WebPartManager != null)
            {
                selectedZone = WebPartManager.Zones[_selectedZoneID];
            }

            CatalogPart selectedCatalogPart = SelectedCatalogPart;
            WebPartDescriptionCollection availableWebParts = null;

            if (selectedCatalogPart != null)
            {
                availableWebParts = selectedCatalogPart.GetAvailableWebPartDescriptions();
            }

            if (selectedZone != null && selectedZone.AllowLayoutChange &&
                _selectedCheckBoxValues != null && availableWebParts != null)
            {
                ArrayList selectedWebParts = new ArrayList();

                // Fetch all of the WebParts before calling AddWebPart() on any of them.
                // This is necessary if the CatalogPart would refresh its list of
                // AvailableWebPartDescriptions in response to adding a WebPart.
                // PageCatalogPart is an example of this. (VSWhidbey 337539)
                for (int i = 0; i < _selectedCheckBoxValues.Length; i++)
                {
                    string             value = _selectedCheckBoxValues[i];
                    WebPartDescription webPartDescription = availableWebParts[value];
                    if (webPartDescription != null)
                    {
                        WebPart part = selectedCatalogPart.GetWebPart(webPartDescription);
                        if (part != null)
                        {
                            selectedWebParts.Add(part);
                        }
                    }
                }

                AddWebParts(selectedWebParts, selectedZone);
            }
        }
        private void RenderItems(HtmlTextWriter writer, CatalogPart catalogPart) {
            WebPartDescriptionCollection availableWebParts = catalogPart.GetAvailableWebPartDescriptions();

            if (availableWebParts != null) {
                foreach (WebPartDescription webPartDescription in availableWebParts) {
                    RenderItem(writer, webPartDescription);
                }
            }
        }