Esempio n. 1
0
        /// <inheritdoc />
        protected override bool BindControlValue(string propertyName)
        {
            ProjectProperty projProp;
            VisibleItems    items;

#if !STANDALONEGUI
            if (this.ProjectMgr == null)
            {
                return(false);
            }
#else
            if (this.CurrentProject == null)
            {
                return(false);
            }
#endif

            if (propertyName == "ApiFilter")
            {
                // Pass it the Sandcastle project instance as we use the designer dialog to edit the collection
                // and it obtains it from the collection to do the required partial build.
#if !STANDALONEGUI
                var filter = new ApiFilterCollection {
                    Project = ((SandcastleBuilderProjectNode)this.ProjectMgr).SandcastleProject
                };

                projProp = this.ProjectMgr.BuildProject.GetProperty("ApiFilter");
#else
                var filter = new ApiFilterCollection {
                    Project = base.CurrentProject
                };

                projProp = this.CurrentProject.MSBuildProject.GetProperty("ApiFilter");
#endif
                if (projProp != null && !String.IsNullOrEmpty(projProp.UnevaluatedValue))
                {
                    filter.FromXml(projProp.UnevaluatedValue);
                }

                ucVisibilityPropertiesPageContent.ApiFilter           = filter;
                ucVisibilityPropertiesPageContent.ApiFilterHasChanges = false;
                ucVisibilityPropertiesPageContent.UpdateApiFilterInfo();
                return(true);
            }

#if !STANDALONEGUI
            projProp = this.ProjectMgr.BuildProject.GetProperty("VisibleItems");
#else
            projProp = this.CurrentProject.MSBuildProject.GetProperty("VisibleItems");
#endif
            // If not found or not valid, we'll ignore it and use the defaults
            if (projProp == null || !Enum.TryParse <VisibleItems>(projProp.UnevaluatedValue, out items))
            {
                items = VisibleItems.InheritedFrameworkMembers | VisibleItems.InheritedMembers |
                        VisibleItems.Protected | VisibleItems.ProtectedInternalAsProtected | VisibleItems.NonBrowsable;
            }

            ucVisibilityPropertiesPageContent.VisibleItems = items;
            return(true);
        }
        /// <summary>
        /// Edit the project's API filter
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event arguments</param>
        private void btnEditAPIFilter_Click(object sender, EventArgs e)
        {
#if !STANDALONEGUI
            if (this.ProjectMgr == null)
            {
                return;
            }

            // Apply any pending visibility changes first
            if (this.IsDirty && ((IPropertyPage)this).Apply() != VSConstants.S_OK)
            {
                return;
            }

            // Create an API filter collection that we can edit
            ApiFilterCollection filter = new ApiFilterCollection {
                Project =
                    ((SandcastleBuilderProjectNode)this.ProjectMgr).SandcastleProject
            };
#else
            if (base.CurrentProject == null)
            {
                return;
            }

            // Apply any pending visibility changes first
            if (this.IsDirty && !this.Apply())
            {
                return;
            }

            // Create an API filter collection that we can edit
            ApiFilterCollection filter = new ApiFilterCollection {
                Project = base.CurrentProject
            };
#endif
            filter.FromXml(apiFilter);

            using (ApiFilterEditorDlg dlg = new ApiFilterEditorDlg(filter))
            {
                dlg.ShowDialog();

                string newFilter = filter.ToXml();

                // If it changes, mark the page as dirty and update the local copy of the filter
                if (apiFilter != newFilter)
                {
                    apiFilter    = newFilter;
                    this.IsDirty = filterChanged = true;
                    this.UpdateApiFilterInfo();
                }
            }
        }
        /// <summary>
        /// Edit the project's API filter
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event arguments</param>
        private void btnEditAPIFilter_Click(object sender, EventArgs e)
        {
#if !STANDALONEGUI
            if(this.ProjectMgr == null)
                return;

            // Apply any pending visibility changes first
            if(this.IsDirty && ((IPropertyPage)this).Apply() != VSConstants.S_OK)
                return;

            // Create an API filter collection that we can edit
            ApiFilterCollection filter = new ApiFilterCollection { Project =
                ((SandcastleBuilderProjectNode)this.ProjectMgr).SandcastleProject };
#else
            if(base.CurrentProject == null)
                return;

            // Apply any pending visibility changes first
            if(this.IsDirty && !this.Apply())
                return;

            // Create an API filter collection that we can edit
            ApiFilterCollection filter = new ApiFilterCollection { Project = base.CurrentProject };
#endif
            filter.FromXml(apiFilter);

            using(ApiFilterEditorDlg dlg = new ApiFilterEditorDlg(filter))
            {
                dlg.ShowDialog();

                string newFilter = filter.ToXml();

                // If it changes, mark the page as dirty and update the local copy of the filter
                if(apiFilter != newFilter)
                {
                    apiFilter = newFilter;
                    this.IsDirty = filterChanged = true;
                    this.UpdateApiFilterInfo();
                }
            }
        }