private void ReadStyleSheetRelation(ReaderContext context, XmlTextReader reader) { StyleRegistration styleRegistration = new StyleRegistration(); while (reader.MoveToNextAttribute()) { if (reader.Name == "RegistrationType") { styleRegistration.RegistrationType = reader.Value; } else if (reader.Name == "ControlType") { styleRegistration.ControlType = reader.Value; } else if (reader.Name == "ControlName") { styleRegistration.ControlName = reader.Value; } else if (reader.Name == "ElementType") { styleRegistration.ElementType = reader.Value; } else if (reader.Name == "ElementName") { styleRegistration.ElementName = reader.Value; } } context.currentStyleGroup.Registrations.Add(styleRegistration); }
private static void AddBuilderToList( ArrayList res, StyleGroup builder, BuilderRegistrationType regType, string elementType, string controlType, string elementName, string controlName) { bool flag = false; foreach (StyleGroup re in res) { if (re == builder) { StyleRegistration styleRegistration = new StyleRegistration(regType.ToString(), elementType, controlType, elementName, controlName); re.Registrations.Add(styleRegistration); flag = true; } } if (flag) { return; } StyleGroup styleGroup = new StyleGroup(); StyleRegistration styleRegistration1 = new StyleRegistration(regType.ToString(), elementType, controlType, elementName, controlName); styleGroup.Registrations.Add(styleRegistration1); res.Add((object)styleGroup); }
public StyleRegistration(StyleRegistration registration) { this.registrationType = registration.registrationType; this.elementType = registration.elementType; this.controlType = registration.controlType; this.elementName = registration.elementName; this.controlName = registration.controlName; }
public bool IsCompatible(StyleRegistration registration) { if (this.compareStrings(this.elementName, registration.elementName) && this.compareStrings(this.elementType, registration.elementType) && (this.compareStrings(this.controlName, registration.controlName) && this.compareStrings(this.controlType, registration.controlType))) { return(this.compareStrings(this.registrationType, registration.registrationType)); } return(false); }
public StyleGroup(StyleRegistration registration) : this() { this.registrations.Add(registration); }
private Theme Parse(CSSParser parser) { Theme theme = new Theme(); theme.StyleGroups.Add(new StyleGroup()); foreach (CSSGroup group in parser.groups) { if (group.name == "theme") { theme.Name = group["name"].value; StyleRegistration styleRegistration = new StyleRegistration(); theme.StyleGroups[0].Registrations.Add(styleRegistration); if (group.Contains("elementType")) { styleRegistration.RegistrationType = "ElementTypeDefault"; styleRegistration.ElementType = group["elementType"].value; } if (group.Contains("controlType")) { styleRegistration.RegistrationType = "ElementTypeControlType"; styleRegistration.ControlType = group["controlType"].value; styleRegistration.ElementType = "Telerik.WinControls.RootRadElement"; } } else if (group.name.StartsWith("#")) { StyleRepository styleRepository = new StyleRepository(); styleRepository.Key = group.name.Remove(0, 1).Trim(); foreach (CSSItem cssItem in group.items) { PropertySetting propertySetting = this.CreatePropertySetting(cssItem); styleRepository.Settings.Add(propertySetting); } theme.Repositories.Add(styleRepository); } else { PropertySettingGroup propertySettingGroup = new PropertySettingGroup(); if (group.BasedOn.Count > 0) { StringBuilder stringBuilder = new StringBuilder(); for (int index = 0; index < group.BasedOn.Count; ++index) { string str = group.BasedOn[index]; stringBuilder.Append(str); if (index < group.BasedOn.Count - 1) { stringBuilder.Append(","); } } propertySettingGroup.BasedOn = stringBuilder.ToString(); } propertySettingGroup.Selector = new ElementSelector(); propertySettingGroup.Selector.Type = ElementSelectorTypes.VisualStateSelector; propertySettingGroup.Selector.Value = group.name; if (!string.IsNullOrEmpty(group.childName)) { propertySettingGroup.Selector.ChildSelector = new ElementSelector(group.childName); propertySettingGroup.Selector.ChildSelector.IsRecursive = true; } theme.StyleGroups[0].PropertySettingGroups.Add(propertySettingGroup); foreach (CSSItem cssItem in group.items) { if (cssItem.name == "selectChild") { propertySettingGroup.Selector.ChildSelector = new ElementSelector(ElementSelectorTypes.VisualStateSelector, cssItem.value); propertySettingGroup.Selector.ChildSelector.IsRecursive = true; } else { if (cssItem.name == "selectChildClass") { propertySettingGroup.Selector.ChildSelector = new ElementSelector(ElementSelectorTypes.ClassSelector, cssItem.value); } PropertySetting propertySetting = this.CreatePropertySetting(cssItem); propertySettingGroup.PropertySettings.Add(propertySetting); } } } } return(theme); }