private static StyleGroup GetStyleSheetBuilder(
            IComponentTreeHandler control,
            string elementTypeFullName,
            string elementName,
            string proposedThemeName,
            bool rootElementHasStyle,
            StyleSheet rootElementStyle)
        {
            string controlType = typeof(RadControl).FullName;
            string themeName   = (string)null;
            string controlID   = string.Empty;

            if (control != null)
            {
                themeName = control.ThemeName;
                Control control1 = control as Control;
                if (control1 != null)
                {
                    controlID = control1.Name;
                }
                controlType = control.ThemeClassName;
            }
            StyleGroup styleGroup = (StyleGroup)null;

            if (ThemeResolutionService.applicationThemeName != null)
            {
                styleGroup = ThemeResolutionService.LookUpStyleBuilder(controlID, controlType, elementName, elementTypeFullName, rootElementHasStyle, rootElementStyle, ThemeResolutionService.applicationThemeName);
            }
            bool flag = false;

            if (styleGroup == null && !string.IsNullOrEmpty(proposedThemeName))
            {
                flag       = true;
                styleGroup = ThemeResolutionService.LookUpStyleBuilder(controlID, controlType, elementName, elementTypeFullName, rootElementHasStyle, rootElementStyle, proposedThemeName);
            }
            if (!flag && styleGroup == null && !string.IsNullOrEmpty(themeName))
            {
                flag       = true;
                styleGroup = ThemeResolutionService.LookUpStyleBuilder(controlID, controlType, elementName, elementTypeFullName, rootElementHasStyle, rootElementStyle, themeName);
            }
            if (!flag && styleGroup == null)
            {
                styleGroup = ThemeResolutionService.LookUpStyleBuilder(controlID, controlType, elementName, elementTypeFullName, rootElementHasStyle, rootElementStyle, ThemeResolutionService.ControlDefaultThemeName);
            }
            if (styleGroup == null)
            {
                styleGroup = ThemeResolutionService.LookUpStyleBuilder(controlID, controlType, elementName, elementTypeFullName, rootElementHasStyle, rootElementStyle, "*");
            }
            return(styleGroup);
        }