protected static void FindSkinAndTheme(out Skin skin, out Theme theme) { IScreenManager screenManager = ServiceRegistration.Get<IScreenManager>(); ISkinResourceBundle bundle = screenManager.CurrentSkinResourceBundle; theme = bundle as Theme; skin = bundle as Skin; if (theme != null) skin = bundle.InheritedSkinResources as Skin; }
/// <summary> /// Adds the resources and themes in the specified directory. /// </summary> /// <param name="skinDirectoryPath">Path to a directory whose contents should be added /// to the file cache.</param> protected override void LoadDirectory(string skinDirectoryPath) { base.LoadDirectory(skinDirectoryPath); ILogger logger = ServiceRegistration.Get<ILogger>(); // Add themes string themesDirectoryPath = Path.Combine(skinDirectoryPath, THEMES_DIRECTORY); if (Directory.Exists(themesDirectoryPath)) foreach (string themeDirectoryPath in Directory.GetDirectories(themesDirectoryPath)) { // Iterate over all themes subdirectories string themeName = Path.GetFileName(themeDirectoryPath); if (themeName == null || themeName.StartsWith(".")) continue; Theme theme; if (_themes.ContainsKey(themeName)) theme = _themes[themeName]; else { logger.Debug("Skin '{0}': Adding theme '{1}'", _name, themeName); theme = _themes[themeName] = new Theme(themeName, this); } theme.AddRootDirectory(themeDirectoryPath); } }