示例#1
0
        private string GetBuilderString(XmlStyleBuilderRegistration builder)
        {
            string res = string.Empty;

            if (builder.StylesheetRelations.Count != 1)
            {
                throw new InvalidOperationException("Stylesheet registration contais relations for more than one control");
            }

            RadStylesheetRelation relation = builder.StylesheetRelations[0];

            if (relation.RegistrationType == BuilderRegistrationType.ElementTypeControlType)
            {
                res = "Style for controls of Type " + relation.ControlType;
                if (relation.ElementType != typeof(RootRadElement).FullName)
                {
                    res += " and elements of Type " + relation.ElementType;
                }
            }
            else
            if (relation.RegistrationType == BuilderRegistrationType.ElementTypeDefault)
            {
                res = "Style for elements of Type " + relation.ElementType;
            }
            else
            if (relation.RegistrationType == BuilderRegistrationType.ElementTypeDefault)
            {
                res = "Style for elements of Type " + relation.ElementType;
            }

            return(res);
        }
示例#2
0
 public bool Equals(RadStylesheetRelation relation)
 {
     if (this.registrationType == relation.registrationType && string.CompareOrdinal(this.elementType, relation.elementType) == 0 && (string.CompareOrdinal(this.controlType, relation.controlType) == 0 && string.CompareOrdinal(this.elementName, relation.elementName) == 0))
     {
         return(string.CompareOrdinal(this.controlName, relation.controlName) == 0);
     }
     return(false);
 }
        public XmlStyleBuilderRegistration(XmlStyleSheet style, string controlType, string elementType)
        {
            this.builderData         = (XmlBuilderData)style;
            this.stylesheetRelations = new RadStyleSheetRelationList(1);
            RadStylesheetRelation stylesheetRelation = new RadStylesheetRelation();

            this.StylesheetRelations.Add(stylesheetRelation);
            stylesheetRelation.RegistrationType = BuilderRegistrationType.ElementTypeControlType;
            stylesheetRelation.ElementType      = elementType ?? string.Empty;
            stylesheetRelation.ControlType      = controlType ?? string.Empty;
        }
        public XmlStyleBuilderRegistration(StyleBuilderRegistration toCopyFrom)
        {
            this.BuilderType = toCopyFrom.Builder.GetType();
            this.BuilderData = toCopyFrom.Builder.BuilderData;

            foreach (RadStylesheetRelation relationToCopy in toCopyFrom.StylesheetRelations)
            {
                RadStylesheetRelation relation = new RadStylesheetRelation();

                relation.RegistrationType = relationToCopy.RegistrationType;
                relation.ControlName      = relationToCopy.ControlName;
                relation.ControlType      = relationToCopy.ControlType;
                relation.ElementName      = relationToCopy.ElementName;
                relation.ElementType      = relationToCopy.ElementType;

                this.StylesheetRelations.Add(relation);
            }
        }
        public StyleBuilderRegistration(
            BuilderRegistrationType registrationType,
            string elementType,
            string controlType,
            string elementName,
            string controlName,
            StyleBuilder builder)
        {
            this.builder = builder;

            this.stylesheetRelations = new List <RadStylesheetRelation>(1);
            RadStylesheetRelation relation = new RadStylesheetRelation();

            this.stylesheetRelations.Add(relation);

            relation.RegistrationType = registrationType;
            relation.ElementName      = elementName;
            relation.ControlName      = controlName;
            relation.ControlType      = controlType;
            relation.ElementType      = elementType;
        }
        private static void AddBuilderToList(ArrayList res, StyleBuilder builder, BuilderRegistrationType regType, string elementType, string controlType, string elementName, string controlName)
        {
            bool found = false;

            foreach (StyleBuilderRegistration reg in res)
            {
                if (reg.Builder == builder)
                {
                    RadStylesheetRelation relation = new RadStylesheetRelation(
                        regType, elementType, controlType, elementName, controlName);
                    reg.StylesheetRelations.Add(relation);
                    found = true;
                }
            }

            if (!found)
            {
                StyleBuilderRegistration registration = new StyleBuilderRegistration(
                    regType, elementType, controlType, elementName, controlName, builder);
                res.Add(registration);
            }
        }
        public void AddStylesheetRelation(BuilderRegistrationType type, string elementType, string controlType, string elementName, string controlName)
        {
            RadStylesheetRelation relation = new RadStylesheetRelation(type, elementType, controlType, elementName, controlName);

            this.StylesheetRelations.Add(relation);
        }