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 RadStylesheetRelation(BuilderRegistrationType type, string elementType, string controlType, string elementName, string controlName)
 {
     this.registrationType = type;
     this.elementType      = elementType ?? string.Empty;
     this.controlType      = controlType ?? string.Empty;
     this.elementName      = elementName ?? string.Empty;
     this.controlName      = controlName ?? string.Empty;
 }
        public static StyleGroup[] GetStyleSheetBuilders(string themeName)
        {
            if (string.IsNullOrEmpty(themeName))
            {
                themeName = ThemeResolutionService.ControlDefaultThemeName;
            }
            ArrayList res = new ArrayList();

            foreach (DictionaryEntry dictionaryEntry in ThemeResolutionService.registeredBuildersDefaultByElementType)
            {
                ThemeResolutionService.TripleNameKey key = (ThemeResolutionService.TripleNameKey)dictionaryEntry.Key;
                if (string.Compare(key.Name2, themeName, true) == 0)
                {
                    StyleGroup builder = (StyleGroup)dictionaryEntry.Value;
                    BuilderRegistrationType regType = BuilderRegistrationType.ElementTypeDefault;
                    string name3       = key.Name3;
                    string controlType = (string)null;
                    string elementName = (string)null;
                    string controlName = (string)null;
                    ThemeResolutionService.AddBuilderToList(res, builder, regType, name3, controlType, elementName, controlName);
                }
            }
            foreach (DictionaryEntry dictionaryEntry in ThemeResolutionService.registeredBuildersByElementTypeControlType)
            {
                ThemeResolutionService.TripleNameKey key = (ThemeResolutionService.TripleNameKey)dictionaryEntry.Key;
                if (string.Compare(key.Name3, themeName, true) == 0)
                {
                    StyleGroup builder = (StyleGroup)dictionaryEntry.Value;
                    BuilderRegistrationType regType = BuilderRegistrationType.ElementTypeControlType;
                    string name2       = key.Name2;
                    string name1       = key.Name1;
                    string elementName = (string)null;
                    string controlName = (string)null;
                    ThemeResolutionService.AddBuilderToList(res, builder, regType, name2, name1, elementName, controlName);
                }
            }
            foreach (DictionaryEntry dictionaryEntry in ThemeResolutionService.registeredBuildersName)
            {
                if (string.Compare((string)dictionaryEntry.Key, themeName, true) == 0)
                {
                    StyleGroup builder = (StyleGroup)dictionaryEntry.Value;
                    BuilderRegistrationType regType = BuilderRegistrationType.ElementTypeGlobal;
                    string elementType = (string)null;
                    string controlType = (string)null;
                    string elementName = (string)null;
                    string controlName = (string)null;
                    ThemeResolutionService.AddBuilderToList(res, builder, regType, elementType, controlType, elementName, controlName);
                }
            }
            StyleGroup[] styleGroupArray = new StyleGroup[res.Count];
            res.CopyTo((Array)styleGroupArray, 0);
            return(styleGroupArray);
        }
Esempio n. 4
0
        public void RemoveRelationForItem(VsbItemMetadata metadata, BuilderRegistrationType registrationType)
        {
            StyleBuilderRegistration registration = this.GetStyleBuilderRegistration(metadata);

            if (registration == null)
            {
                throw new InvalidOperationException("Could not add relation for Item " + metadata.ItemThemeRole + " because no style registration is available.");
            }

            foreach (RadStylesheetRelation relation in registration.StylesheetRelations)
            {
                if (relation.RegistrationType == registrationType &&
                    metadata.ElementThemeType.FullName == relation.ElementType)
                {
                    registration.StylesheetRelations.Remove(relation);
                    break;
                }
            }
        }
Esempio n. 5
0
        public void AddRelationForItem(VsbItemMetadata metadata, BuilderRegistrationType registrationType)
        {
            StyleBuilderRegistration registration = this.GetStyleBuilderRegistration(metadata);

            if (registration == null)
            {
                throw new InvalidOperationException("Could not add relation for Item " + metadata.ItemThemeRole + " because no style registration is available.");
            }

            string controlType = string.Empty;

            if (registrationType == BuilderRegistrationType.ElementTypeControlType ||
                registrationType == BuilderRegistrationType.ElementNameControlType)
            {
                controlType = this.PreviewTreeHandler.ThemeClassName;
            }

            registration.AddStylesheetRelation(registrationType, metadata.ElementThemeType.FullName, controlType, string.Empty, string.Empty);
        }
Esempio n. 6
0
        public RadStylesheetRelation FindRelation(VsbItemMetadata metadata, BuilderRegistrationType registrationType)
        {
            StyleBuilderRegistration registration = this.GetStyleBuilderRegistration(metadata);

            if (registration == null)
            {
                return(null);
            }

            foreach (RadStylesheetRelation relation in registration.StylesheetRelations)
            {
                if (relation.RegistrationType == registrationType &&
                    metadata.ElementThemeType.FullName == relation.ElementType)
                {
                    return(relation);
                }
            }

            return(null);
        }
        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);
            }
        }
        /// <summary>
        /// Gets all StyleSheets registered under a theme name.
        /// </summary>
        /// <param name="themeName"></param>
        /// <returns></returns>
        public static StyleBuilderRegistration[] GetStyleSheetBuilders(string themeName)
        {
            if (string.IsNullOrEmpty(themeName))
            {
                themeName = ControlDefaultThemeName;
            }

            ArrayList res = new ArrayList();

            foreach (DictionaryEntry entry in registeredBuildersDefaultByElementType)
            {
                TripleNameKey key = (TripleNameKey)entry.Key;
                if (string.Compare(key.Name2, themeName, true) == 0)
                {
                    StyleBuilder builder = (StyleBuilder)entry.Value;


                    BuilderRegistrationType regType = BuilderRegistrationType.ElementTypeDefault;
                    string elementType = key.Name3;
                    string controlType = null;
                    string elementName = null;
                    string controlName = null;

                    AddBuilderToList(res, builder, regType, elementType, controlType, elementName, controlName);
                }
            }

            foreach (DictionaryEntry entry in registeredBuildersByElementTypeControlType)
            {
                TripleNameKey key = (TripleNameKey)entry.Key;
                if (string.Compare(key.Name3, themeName, true) == 0)
                {
                    StyleBuilder            builder = (StyleBuilder)entry.Value;
                    BuilderRegistrationType regType = BuilderRegistrationType.ElementTypeControlType;
                    string elementType = key.Name2;
                    string controlType = key.Name1;
                    string elementName = null;
                    string controlName = null;

                    AddBuilderToList(res, builder, regType, elementType, controlType, elementName, controlName);
                }
            }

            foreach (DictionaryEntry entry in registeredBuildersName)
            {
                string key = (string)entry.Key;
                if (string.Compare(key, themeName, true) == 0)
                {
                    StyleBuilder            builder = (StyleBuilder)entry.Value;
                    BuilderRegistrationType regType = BuilderRegistrationType.ElementTypeGlobal;
                    string elementType = null;
                    string controlType = null;
                    string elementName = null;
                    string controlName = null;

                    AddBuilderToList(res, builder, regType, elementType, controlType, elementName, controlName);
                }
            }

            StyleBuilderRegistration[] resArray = new StyleBuilderRegistration[res.Count];
            res.CopyTo(resArray, 0);

            return(resArray);
        }
Esempio n. 10
0
        public ControlStyleBuilderInfo(RadControl previewControl, RadElement theamableRoot, string controlClassName, BuilderRegistrationType builderRegistrationType)
        {
            this.previewControl = previewControl;
            this.theamableRoot  = theamableRoot;

            registration = new XmlStyleBuilderRegistration();
            RadStylesheetRelation relation = new RadStylesheetRelation();

            registration.StylesheetRelations.Add(relation);

            relation.RegistrationType = builderRegistrationType;
            relation.ElementType      = theamableRoot.GetThemeEffectiveType().FullName;
            relation.ControlType      = controlClassName;
        }
Esempio n. 11
0
 public ThemeDesignedControl(RadControl previewControl, RadElement theamableRoot, string controlClassName, BuilderRegistrationType builderRegistrationType) : base(previewControl, theamableRoot, controlClassName, builderRegistrationType)
 {
 }
        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);
        }