Exemplo n.º 1
0
            /// <include file='doc\ComponentEditorForm.uex' path='docs/doc[@for="ComponentEditorForm.ComponentEditorPageSite.ComponentEditorPageSite"]/*' />
            /// <devdoc>
            ///     Creates the page site.
            /// </devdoc>
            /// <internalonly/>
            internal ComponentEditorPageSite(Control parent, Type pageClass, IComponent component, ComponentEditorForm form)
            {
                this.component = component;
                this.parent    = parent;
                this.isActive  = false;
                this.isDirty   = false;

                if (form == null)
                {
                    throw new ArgumentNullException(nameof(form));
                }

                this.form = form;

                try {
                    pageControl = (ComponentEditorPage)Activator.CreateInstance(pageClass);
                }
                catch (TargetInvocationException e) {
                    Debug.Fail(e.ToString());
                    throw new TargetInvocationException(string.Format(SR.ExceptionCreatingCompEditorControl, e.ToString()), e.InnerException);
                }

                pageControl.SetSite(this);
                pageControl.SetComponent(component);
            }
Exemplo n.º 2
0
		public virtual bool EditComponent (ITypeDescriptorContext context, object component, IWin32Window owner)
		{
			ComponentEditorForm f = new ComponentEditorForm (component, GetComponentEditorPages ());
			if (f.ShowForm (owner, GetInitialComponentEditorPageIndex ()) == DialogResult.OK)
				return true;
			return false;
		}
 public override bool EditComponent(ITypeDescriptorContext context, object obj, IWin32Window parent)
 {
     bool flag = false;
     bool inTemplateModeInternal = false;
     IComponent component = (IComponent) obj;
     ISite site = component.Site;
     if (site != null)
     {
         IDesignerHost service = (IDesignerHost) site.GetService(typeof(IDesignerHost));
         TemplatedControlDesigner designer = (TemplatedControlDesigner) service.GetDesigner(component);
         inTemplateModeInternal = designer.InTemplateModeInternal;
     }
     if (!inTemplateModeInternal)
     {
         System.Type[] componentEditorPages = this.GetComponentEditorPages();
         if ((componentEditorPages != null) && (componentEditorPages.Length != 0))
         {
             ComponentEditorForm form = new ComponentEditorForm(obj, componentEditorPages);
             if (!string.Equals(System.Design.SR.GetString("RTL"), "RTL_False", StringComparison.Ordinal))
             {
                 form.RightToLeft = RightToLeft.Yes;
                 form.RightToLeftLayout = true;
             }
             if (form.ShowForm(parent, this.GetInitialComponentEditorPageIndex()) == DialogResult.OK)
             {
                 flag = true;
             }
         }
         return flag;
     }
     System.Windows.Forms.Design.RTLAwareMessageBox.Show(null, System.Design.SR.GetString("BDL_TemplateModePropBuilder"), System.Design.SR.GetString("BDL_PropertyBuilder"), MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1, 0);
     return flag;
 }
        public virtual bool EditComponent(ITypeDescriptorContext context, object component, IWin32Window owner)
        {
            ComponentEditorForm f = new ComponentEditorForm(component, GetComponentEditorPages());

            if (f.ShowForm(owner, GetInitialComponentEditorPageIndex()) == DialogResult.OK)
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 5
0
        /// <summary>
        ///  Activates the advanced UI used to edit the component.
        /// </summary>
        public virtual bool EditComponent(ITypeDescriptorContext context, object component, IWin32Window owner)
        {
            Type[] pageControlTypes = GetComponentEditorPages();
            if (pageControlTypes == null || pageControlTypes.Length == 0)
            {
                return(false);
            }

            ComponentEditorForm form = new ComponentEditorForm(component, pageControlTypes);

            return(form.ShowForm(owner, GetInitialComponentEditorPageIndex()) == DialogResult.OK);
        }
 public virtual bool EditComponent(ITypeDescriptorContext context, object component, IWin32Window owner)
 {
     bool flag = false;
     System.Type[] componentEditorPages = this.GetComponentEditorPages();
     if ((componentEditorPages != null) && (componentEditorPages.Length != 0))
     {
         ComponentEditorForm form = new ComponentEditorForm(component, componentEditorPages);
         if (form.ShowForm(owner, this.GetInitialComponentEditorPageIndex()) == DialogResult.OK)
         {
             flag = true;
         }
     }
     return flag;
 }
        /// <include file='doc\WinFormsComponentEditor.uex' path='docs/doc[@for="WindowsFormsComponentEditor.EditComponent2"]/*' />
        /// <devdoc>
        ///    <para> 
        ///       Activates the advanced UI used to edit the component.</para>
        /// </devdoc>
        public virtual bool EditComponent(ITypeDescriptorContext context, object component, IWin32Window owner) {
            bool changed = false;
            Type[] pageControlTypes = GetComponentEditorPages();

            if ((pageControlTypes != null) && (pageControlTypes.Length != 0)) {
                ComponentEditorForm form = new ComponentEditorForm(component,
                                                                   pageControlTypes);

                if (form.ShowForm(owner, GetInitialComponentEditorPageIndex()) == DialogResult.OK)
                    changed = true;
            }

            return changed;
        }
Exemplo n.º 8
0
        public virtual bool EditComponent(ITypeDescriptorContext context, object component, IWin32Window owner)
        {
            bool flag = false;

            System.Type[] componentEditorPages = this.GetComponentEditorPages();
            if ((componentEditorPages != null) && (componentEditorPages.Length != 0))
            {
                ComponentEditorForm form = new ComponentEditorForm(component, componentEditorPages);
                if (form.ShowForm(owner, this.GetInitialComponentEditorPageIndex()) == DialogResult.OK)
                {
                    flag = true;
                }
            }
            return(flag);
        }
Exemplo n.º 9
0
        /// <include file='doc\WinFormsComponentEditor.uex' path='docs/doc[@for="WindowsFormsComponentEditor.EditComponent2"]/*' />
        /// <devdoc>
        ///    <para>
        ///       Activates the advanced UI used to edit the component.</para>
        /// </devdoc>
        public virtual bool EditComponent(ITypeDescriptorContext context, object component, IWin32Window owner)
        {
            bool changed = false;

            Type[] pageControlTypes = GetComponentEditorPages();

            if ((pageControlTypes != null) && (pageControlTypes.Length != 0))
            {
                ComponentEditorForm form = new ComponentEditorForm(component,
                                                                   pageControlTypes);

                if (form.ShowForm(owner, GetInitialComponentEditorPageIndex()) == DialogResult.OK)
                {
                    changed = true;
                }
            }

            return(changed);
        }
Exemplo n.º 10
0
 internal ComponentEditorPageSite(Control parent, System.Type pageClass, IComponent component, ComponentEditorForm form)
 {
     this.component = component;
     this.parent    = parent;
     this.isActive  = false;
     this.isDirty   = false;
     if (form == null)
     {
         throw new ArgumentNullException("form");
     }
     this.form = form;
     try
     {
         this.pageControl = (ComponentEditorPage)System.Windows.Forms.SecurityUtils.SecureCreateInstance(pageClass);
     }
     catch (TargetInvocationException exception)
     {
         throw new TargetInvocationException(System.Windows.Forms.SR.GetString("ExceptionCreatingCompEditorControl", new object[] { exception.ToString() }), exception.InnerException);
     }
     this.pageControl.SetSite(this);
     this.pageControl.SetComponent(component);
 }
Exemplo n.º 11
0
            /// <summary>
            ///  Creates the page site.
            /// </summary>
            internal ComponentEditorPageSite(Control parent, Type pageClass, IComponent component, ComponentEditorForm form)
            {
                _component = component;
                _parent    = parent;
                _isActive  = false;
                _isDirty   = false;

                _form = form.OrThrowIfNull();

                try
                {
                    _pageControl = (ComponentEditorPage)Activator.CreateInstance(pageClass) !;
                }
                catch (TargetInvocationException e)
                {
                    Debug.Fail(e.ToString());
                    throw new TargetInvocationException(string.Format(SR.ExceptionCreatingCompEditorControl, e.ToString()), e.InnerException);
                }

                _pageControl.SetSite(this);
                _pageControl.SetComponent(component);
            }
 internal ComponentEditorPageSite(Control parent, System.Type pageClass, IComponent component, ComponentEditorForm form)
 {
     this.component = component;
     this.parent = parent;
     this.isActive = false;
     this.isDirty = false;
     if (form == null)
     {
         throw new ArgumentNullException("form");
     }
     this.form = form;
     try
     {
         this.pageControl = (ComponentEditorPage) System.Windows.Forms.SecurityUtils.SecureCreateInstance(pageClass);
     }
     catch (TargetInvocationException exception)
     {
         throw new TargetInvocationException(System.Windows.Forms.SR.GetString("ExceptionCreatingCompEditorControl", new object[] { exception.ToString() }), exception.InnerException);
     }
     this.pageControl.SetSite(this);
     this.pageControl.SetComponent(component);
 }
Exemplo n.º 13
0
 private ComponentEditorForm CreateForm(object component, Type[] pages)
 {
     var form = new ComponentEditorForm(component, pages);
     form.ShowIcon = false;
     return form;
 }
Exemplo n.º 14
0
            /// <include file='doc\ComponentEditorForm.uex' path='docs/doc[@for="ComponentEditorForm.ComponentEditorPageSite.ComponentEditorPageSite"]/*' />
            /// <devdoc>
            ///     Creates the page site.
            /// </devdoc>
            /// <internalonly/>
            internal ComponentEditorPageSite(Control parent, Type pageClass, IComponent component, ComponentEditorForm form) {
                this.component = component;
                this.parent = parent;
                this.isActive = false;
                this.isDirty = false;

                if (form == null)
                    throw new ArgumentNullException("form");

                this.form = form;

                try {
                    pageControl = (ComponentEditorPage)SecurityUtils.SecureCreateInstance(pageClass);
                }
                catch (TargetInvocationException e) {
                    Debug.Fail(e.ToString());
                    throw new TargetInvocationException(SR.GetString(SR.ExceptionCreatingCompEditorControl, e.ToString()), e.InnerException);
                }

                pageControl.SetSite(this);
                pageControl.SetComponent(component);
            }