コード例 #1
0
        public static string LocalizeControl(Control control, IDesignTimeResourceWriter resourceWriter, out string newInnerContent)
        {
            if (control == null)
            {
                throw new ArgumentNullException("control");
            }
            if (resourceWriter == null)
            {
                throw new ArgumentNullException("resourceWriter");
            }
            if (control.Site == null)
            {
                throw new InvalidOperationException();
            }
            IDesignerHost service = (IDesignerHost)control.Site.GetService(typeof(IDesignerHost));
            IDesignerHost parseTimeDesignerHost = new LocalizationDesignerHost(service);
            Control       control2 = (service.GetDesigner(control) as ControlDesigner).CreateClonedControl(parseTimeDesignerHost, false);

            ((IControlDesignerAccessor)control2).SetOwnerControl(control);
            bool   shouldLocalizeInnerContent = ShouldLocalizeInnerContents(control.Site, control);
            string str = LocalizeControl(control2, parseTimeDesignerHost, resourceWriter, shouldLocalizeInnerContent);

            if (shouldLocalizeInnerContent)
            {
                newInnerContent = ControlSerializer.SerializeInnerContents(control2, parseTimeDesignerHost);
                return(str);
            }
            newInnerContent = null;
            return(str);
        }
コード例 #2
0
 public static ITemplate ParseTemplate(IDesignerHost designerHost, string templateText, string directives)
 {
     if (designerHost == null)
     {
         throw new ArgumentNullException("designerHost");
     }
     return(ControlSerializer.DeserializeTemplate(templateText, designerHost));
 }
コード例 #3
0
 public static Control[] ParseControls(IDesignerHost designerHost, string controlText)
 {
     if (designerHost == null)
     {
         throw new ArgumentNullException("designerHost");
     }
     if ((controlText == null) || (controlText.Length == 0))
     {
         throw new ArgumentNullException("controlText");
     }
     return(ControlSerializer.DeserializeControls(controlText, designerHost));
 }
コード例 #4
0
 internal static Control ParseControl(IDesignerHost designerHost, string controlText, bool applyTheme)
 {
     if (designerHost == null)
     {
         throw new ArgumentNullException("designerHost");
     }
     if ((controlText == null) || (controlText.Length == 0))
     {
         throw new ArgumentNullException("controlText");
     }
     return(ControlSerializer.DeserializeControlInternal(controlText, designerHost, applyTheme));
 }
コード例 #5
0
 public static Control ParseControl(IDesignerHost designerHost, string controlText, string directives)
 {
     if (designerHost == null)
     {
         throw new ArgumentNullException("designerHost");
     }
     if ((controlText == null) || (controlText.Length == 0))
     {
         throw new ArgumentNullException("controlText");
     }
     if ((directives != null) && (directives.Length != 0))
     {
         controlText = directives + controlText;
     }
     return(ControlSerializer.DeserializeControl(controlText, designerHost));
 }
コード例 #6
0
 public static void PersistTemplate(TextWriter writer, ITemplate template, IDesignerHost host)
 {
     ControlSerializer.SerializeTemplate(template, writer, host);
 }
コード例 #7
0
 public static string PersistTemplate(ITemplate template, IDesignerHost host)
 {
     return(ControlSerializer.SerializeTemplate(template, host));
 }
コード例 #8
0
 public static void PersistInnerProperties(TextWriter sw, object component, IDesignerHost host)
 {
     ControlSerializer.SerializeInnerProperties(component, host, sw);
 }
コード例 #9
0
 public static string PersistInnerProperties(object component, IDesignerHost host)
 {
     return(ControlSerializer.SerializeInnerProperties(component, host));
 }
コード例 #10
0
 public static void PersistControl(TextWriter sw, Control control, IDesignerHost host)
 {
     ControlSerializer.SerializeControl(control, host, sw);
 }
コード例 #11
0
 public static string PersistControl(Control control, IDesignerHost host)
 {
     return(ControlSerializer.SerializeControl(control, host));
 }
コード例 #12
0
 public static void PersistControl(TextWriter sw, Control control)
 {
     ControlSerializer.SerializeControl(control, sw);
 }
コード例 #13
0
 public static string PersistControl(Control control)
 {
     return(ControlSerializer.SerializeControl(control));
 }