コード例 #1
0
        /// <summary>
        ///    <para>
        ///       Edits a component.
        ///    </para>
        /// </summary>
        /// <param name='parent'>
        ///    The <see cref='System.Windows.Forms.IWin32Window'/> parent.
        /// </param>
        /// <param name='context'>
        /// </param>
        /// <param name=' obj'>
        ///    The component to edit.
        /// </param>
        public override bool EditComponent(ITypeDescriptorContext context, Object obj, IWin32Window parent)
        {
            bool result         = false;
            bool inTemplateMode = false;

            Debug.Assert(obj is IComponent, "Expected obj to be an IComponent");
            IComponent comp     = (IComponent)obj;
            ISite      compSite = comp.Site;

            if (compSite != null)
            {
                IDesignerHost designerHost = (IDesignerHost)compSite.GetService(typeof(IDesignerHost));

                IDesigner compDesigner = designerHost.GetDesigner(comp);
                Debug.Assert(compDesigner is TemplatedControlDesigner,
                             "Expected component to have a TemplatedControlDesigner");

                TemplatedControlDesigner tplDesigner = (TemplatedControlDesigner)compDesigner;
                inTemplateMode = tplDesigner.InTemplateMode;
            }

            if (inTemplateMode == false)
            {
                result = base.EditComponent(context, obj, parent);
            }
            else
            {
                MessageBox.Show(SR.GetString(SR.BaseTemplatedMobileComponentEditor_TemplateModeErrorMessage),
                                SR.GetString(SR.BaseTemplatedMobileComponentEditor_TemplateModeErrorTitle),
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(result);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        // Returns true if the closest templateable ancestor is in template editing mode.
        internal static bool InTemplateFrame(Control control)
        {
            if (control.Parent == null)
            {
                return(false);
            }

            TemplatedControlDesigner designer =
                ControlDesigner(control.Parent) as TemplatedControlDesigner;

            if (designer == null)
            {
                return(InTemplateFrame(control.Parent));
            }

            if (designer.InTemplateMode)
            {
                return(true);
            }

            return(false);
        }
コード例 #4
0
 // Constructors
 public TemplateEditingVerb(string text, int index, TemplatedControlDesigner designer)
 {
 }
コード例 #5
0
 // Methods
 public virtual ITemplateEditingFrame CreateFrame(TemplatedControlDesigner designer, string frameName, string[] templateNames)
 {
 }
コード例 #6
0
 public virtual ITemplateEditingFrame CreateFrame(TemplatedControlDesigner designer, string frameName, string[] templateNames, System.Web.UI.WebControls.Style controlStyle, System.Web.UI.WebControls.Style[] templateStyles)
 {
 }
コード例 #7
0
 // Constructors
 public TemplateEditingVerb(string text, int index, TemplatedControlDesigner designer)
 {
 }
 public virtual ITemplateEditingFrame CreateFrame(TemplatedControlDesigner designer, string frameName, string[] templateNames, System.Web.UI.WebControls.Style controlStyle, System.Web.UI.WebControls.Style[] templateStyles)
 {
 }
 // Methods
 public virtual ITemplateEditingFrame CreateFrame(TemplatedControlDesigner designer, string frameName, string[] templateNames)
 {
 }