Exemplo n.º 1
0
        /// <summary>
        /// Looks the themes table for the specified name and creates the Theme
        /// object
        /// </summary>
        /// <param name="name">Name of the Theme</param>
        /// <returns>true on success</returns>
        public bool SetActiveTheme(String name)
        {
            bool retVal = true;

            Log.Debug("Set active Theme to " + name);

            var themeDir = GetThemeDir(name);

            if (String.IsNullOrEmpty(themeDir))
            {
                Log.Debug("Could not find Theme " + name + ", using default");
                themeDir = GetThemeDir(DefaultThemeName);
                if (String.IsNullOrEmpty(themeDir))
                {
                    return(false);
                }

                name = DefaultThemeName;
            }

            var themeFile = Path.Combine(themeDir, ThemeConfigFileName);

            Log.Debug("Creating Theme " + name + ", themeDir: " + themeDir);

            // create the Theme object. This parses the Theme xml file and
            // creates the Theme object
            var theme = Theme.Create(name, themeDir, themeFile);

            if (theme != null)
            {
                if (_activeTheme != null)
                {
                    _activeTheme.Dispose();
                }

                _activeTheme    = theme;
                ActiveThemeName = name;
                Log.Debug("Created Theme successfully. active Theme is " + _activeTheme.Name);
            }
            else
            {
                Log.Debug("Error creating Theme");
                retVal = false;
            }

            return(retVal);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Looks the themes table for the specified name and creates the Theme
        /// object
        /// </summary>
        /// <param name="name">Name of the Theme</param>
        /// <returns>true on success</returns>
        public bool SetActiveTheme(String name)
        {
            bool retVal    = true;
            var  themeName = name.ToLower();

            Log.Debug("Set active Theme to " + themeName);

            if (!_themesLookupTable.ContainsKey(themeName))
            {
                Log.Debug("Could not find Theme " + themeName + " in the table");
                return(false);
            }
            Log.Debug("Found Theme " + themeName + " in the table");

            var themeDir  = _themesLookupTable[themeName];
            var themeFile = Path.Combine(themeDir, ThemeConfigFileName);

            Log.Debug("Creating Theme " + name + ", themeDir: " + themeDir);

            // create the Theme object. This parses the Theme xml file and
            // creates the Theme object
            var theme = Theme.Create(name, themeDir, themeFile);

            if (theme != null)
            {
                if (_activeTheme != null)
                {
                    _activeTheme.Dispose();
                }

                _activeTheme    = theme;
                ActiveThemeName = name;
                Log.Debug("Created Theme successfully. active Theme is " + _activeTheme.Name);
            }
            else
            {
                Log.Debug("Error creating Theme");
                retVal = false;
            }
            return(retVal);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes the singleton instance of the manager
 /// </summary>
 private ThemeManager()
 {
     ActiveThemeName = "DefaultSkin";
     DefaultTheme    = Theme.Create(ActiveThemeName);
     _activeTheme    = Theme.Create(ActiveThemeName);
 }