public override object EditValue(System.ComponentModel.ITypeDescriptorContext context,
          IServiceProvider provider, object value)
        {
            // Get the namespace summary item collection
            NamespaceSummaryItemCollection items = value as NamespaceSummaryItemCollection;

            if(context == null || provider == null || context.Instance == null ||
              items == null)
                return base.EditValue(context, provider, value);

            using(NamespaceSummaryItemEditorDlg dlg =
              new NamespaceSummaryItemEditorDlg(items))
            {
                dlg.ShowDialog();
            }

            return value;
        }
Esempio n. 2
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context,
                                         IServiceProvider provider, object value)
        {
            // Get the namespace summary item collection
            NamespaceSummaryItemCollection items = value as NamespaceSummaryItemCollection;

            if (context == null || provider == null || context.Instance == null ||
                items == null)
            {
                return(base.EditValue(context, provider, value));
            }

            using (NamespaceSummaryItemEditorDlg dlg =
                       new NamespaceSummaryItemEditorDlg(items))
            {
                dlg.ShowDialog();
            }

            return(value);
        }
        /// <summary>
        /// Edit the project's namespace summaries
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event arguments</param>
        private void btnEditNamespaces_Click(object sender, EventArgs e)
        {
            string oldSummaries, newSummaries;

#if !STANDALONEGUI
            if(this.ProjectMgr == null)
                return;

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

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

            using(NamespaceSummaryItemEditorDlg dlg = new NamespaceSummaryItemEditorDlg(namespaceSummaries))
            {
                oldSummaries = namespaceSummaries.ToXml();
                dlg.ShowDialog();
                newSummaries = namespaceSummaries.ToXml();

                // If it changes, mark the page as dirty and update the summary info
                if(oldSummaries != newSummaries)
                {
                    this.IsDirty = summariesChanged = true;
                    this.UpdateNamespaceSummaryInfo();
                }
            }
        }