public bool Equals(ThemeResolutionService.TripleNameKey key)
 {
     if (string.Compare(this.Name1, key.Name1, true) == 0 && string.Compare(this.Name2, key.Name2, true) == 0)
     {
         return(string.Compare(this.Name3, key.Name3, true) == 0);
     }
     return(false);
 }
 public static void RegisterElementTypeDefaultStyleBuilder(
     string themeName,
     string elementTypeName,
     StyleGroup builder)
 {
     ThemeResolutionService.EnsureThemeRegistered(ThemeResolutionService.ControlDefaultThemeName);
     ThemeResolutionService.TripleNameKey tripleNameKey = new ThemeResolutionService.TripleNameKey("", themeName, elementTypeName);
     ThemeResolutionService.registeredBuildersDefaultByElementType[(object)tripleNameKey] = (object)builder;
 }
 public static void RegisterStyleBuilderByControlName(
     string controlName,
     string elementTypeName,
     StyleGroup builder,
     string themeName)
 {
     ThemeResolutionService.EnsureThemeRegistered(themeName);
     ThemeResolutionService.TripleNameKey tripleNameKey = new ThemeResolutionService.TripleNameKey("__ID" + controlName, elementTypeName, themeName);
     ThemeResolutionService.registeredBuildersByElementTypeControlID[(object)tripleNameKey] = (object)builder;
 }
 public static void RegisterControlStyleBuilder(
     string controlTypeName,
     string elementTypeName,
     StyleGroup builder,
     string themeName)
 {
     ThemeResolutionService.EnsureThemeRegistered(themeName);
     ThemeResolutionService.TripleNameKey tripleNameKey = new ThemeResolutionService.TripleNameKey(controlTypeName, elementTypeName, themeName);
     ThemeResolutionService.registeredBuildersByElementTypeControlType[(object)tripleNameKey] = (object)builder;
     ThemeResolutionService.RaiseThemeChanged(themeName, controlTypeName);
 }
        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);
        }
        private static StyleGroup LookUpStyleBuilder(
            string controlID,
            string controlType,
            string elementName,
            string elementTypeFullName,
            bool rootElementHasStyle,
            StyleSheet rootElementStyle,
            string themeName)
        {
            ThemeResolutionService.TripleNameKey tripleNameKey1 = new ThemeResolutionService.TripleNameKey(elementName ?? "", themeName ?? "", elementTypeFullName);
            StyleGroup builder = ThemeResolutionService.registeredBuildersByElementNameControlID[(object)tripleNameKey1] as StyleGroup;
            int        num     = 0;

            if (builder == null)
            {
                ThemeResolutionService.TripleNameKey tripleNameKey2 = new ThemeResolutionService.TripleNameKey(controlID ?? "", themeName ?? "", elementTypeFullName);
                builder = ThemeResolutionService.registeredBuildersByElementTypeControlID[(object)tripleNameKey2] as StyleGroup;
                num     = 1;
            }
            if (builder == null)
            {
                ThemeResolutionService.TripleNameKey tripleNameKey2 = new ThemeResolutionService.TripleNameKey(controlType, elementTypeFullName, themeName ?? "");
                builder = ThemeResolutionService.registeredBuildersByElementTypeControlID[(object)tripleNameKey2] as StyleGroup;
                num     = 2;
            }
            if (builder == null)
            {
                ThemeResolutionService.TripleNameKey tripleNameKey2 = new ThemeResolutionService.TripleNameKey(controlType, elementTypeFullName, themeName ?? "");
                builder = ThemeResolutionService.registeredBuildersByElementTypeControlType[(object)tripleNameKey2] as StyleGroup;
                num     = 3;
            }
            if (builder == null)
            {
                ThemeResolutionService.TripleNameKey tripleNameKey2 = new ThemeResolutionService.TripleNameKey("", themeName ?? "", elementTypeFullName);
                builder = ThemeResolutionService.registeredBuildersDefaultByElementType[(object)tripleNameKey2] as StyleGroup;
                num     = 4;
            }
            if (builder == null && themeName != null)
            {
                builder = ThemeResolutionService.registeredBuildersName[(object)themeName] as StyleGroup;
                num     = 5;
            }
            ResolveStyleBuilderEventHandler resolveStyleBuilder = ThemeResolutionService.ResolveStyleBuilder;

            if (resolveStyleBuilder != null)
            {
                ResolveStyleBuilderEventArgs e = new ResolveStyleBuilderEventArgs(themeName, builder);
                resolveStyleBuilder((object)null, e);
                builder = e.Builder;
            }
            return(builder);
        }
 public static void ClearTheme(string themeName)
 {
     lock (ThemeResolutionService.syncRoot)
     {
         ArrayList arrayList = new ArrayList();
         foreach (DictionaryEntry dictionaryEntry in ThemeResolutionService.registeredBuildersByElementTypeControlType)
         {
             ThemeResolutionService.TripleNameKey key = (ThemeResolutionService.TripleNameKey)dictionaryEntry.Key;
             if (string.Compare(key.Name3, themeName, true) == 0)
             {
                 arrayList.Add((object)key);
             }
         }
         foreach (object key in arrayList)
         {
             ThemeResolutionService.registeredBuildersByElementTypeControlType.Remove(key);
         }
         arrayList.Clear();
         foreach (DictionaryEntry dictionaryEntry in ThemeResolutionService.registeredBuildersByElementNameControlType)
         {
             ThemeResolutionService.TripleNameKey key = (ThemeResolutionService.TripleNameKey)dictionaryEntry.Key;
             if (string.Compare(key.Name3, themeName, true) == 0)
             {
                 arrayList.Add((object)key);
             }
         }
         foreach (object key in arrayList)
         {
             ThemeResolutionService.registeredBuildersByElementNameControlType.Remove(key);
         }
         arrayList.Clear();
         foreach (DictionaryEntry dictionaryEntry in ThemeResolutionService.registeredBuildersByElementTypeControlID)
         {
             ThemeResolutionService.TripleNameKey key = (ThemeResolutionService.TripleNameKey)dictionaryEntry.Key;
             if (string.Compare(key.Name3, themeName, true) == 0)
             {
                 arrayList.Add((object)key);
             }
         }
         foreach (object key in arrayList)
         {
             ThemeResolutionService.registeredBuildersByElementTypeControlID.Remove(key);
         }
         arrayList.Clear();
         foreach (DictionaryEntry dictionaryEntry in ThemeResolutionService.registeredBuildersDefaultByElementType)
         {
             ThemeResolutionService.TripleNameKey key = (ThemeResolutionService.TripleNameKey)dictionaryEntry.Key;
             if (string.Compare(key.Name3, themeName, true) == 0)
             {
                 arrayList.Add((object)key);
             }
         }
         foreach (object key in arrayList)
         {
             ThemeResolutionService.registeredBuildersDefaultByElementType.Remove(key);
         }
         arrayList.Clear();
         foreach (DictionaryEntry dictionaryEntry in ThemeResolutionService.registeredBuildersName)
         {
             string key = (string)dictionaryEntry.Key;
             if (string.Compare(key, themeName, true) == 0)
             {
                 arrayList.Add((object)key);
             }
         }
         foreach (object key in arrayList)
         {
             ThemeResolutionService.registeredBuildersName.Remove(key);
         }
     }
     ThemeResolutionService.RaiseThemeChanged(themeName, (string)null);
 }