/// <summary> /// Regesters theme from a file or resource that contains a xml-serilized Theme object. /// The Visual Style Builder application for example is capable of designing and serializing /// themes. Theme files generally contain Theme with one or several style sheets each assigned a /// registration that defines which RadControl and/or RadElment the style sheet applies. /// </summary> /// <param name="storageType"></param> /// <param name="resourceParams"></param> public static void RegisterThemeFromStorage(ThemeStorageType storageType, ResourceParams resourceParams) { ThemeSource source = new ThemeSource(); Assembly lookUpAssembly = resourceParams.UserAssembly; if (lookUpAssembly == null) { lookUpAssembly = resourceParams.CallingAssembly; } source.SetCallingAssembly(lookUpAssembly); source.StorageType = storageType; source.ThemeLocation = resourceParams.ResourcePath; source.ReloadThemeFromStorage(); }
public static void RegisterThemeFromAssembly(Assembly assembly, string themeName) { string[] manifestResourceNames = assembly.GetManifestResourceNames(); foreach (string currentName in manifestResourceNames) { if (!currentName.Contains(themeName) || !currentName.EndsWith(".xml")) { continue; } ThemeSource source = new ThemeSource(); source.SetCallingAssembly(Assembly.GetCallingAssembly()); source.StorageType = ThemeStorageType.Resource; source.ThemeLocation = currentName; source.ReloadThemeFromStorage(); } }