public static void RegisterThemeFromStorage(ThemeStorageType storageType, string themeLocation) { XMLThemeReader xmlThemeReader = new XMLThemeReader(); if (storageType == ThemeStorageType.File) { Theme theme = xmlThemeReader.Read(themeLocation); if (theme == null) { return; } ThemeRepository.Add(theme); } else { using (Stream manifestResourceStream = Assembly.GetCallingAssembly().GetManifestResourceStream(themeLocation)) { Theme theme = xmlThemeReader.Read(manifestResourceStream); if (theme == null || string.IsNullOrEmpty(theme.Name)) { return; } ThemeRepository.Add(theme); } } }
public static void RegisterThemeFromStorage(ThemeStorageType storageType, string themeLocation) { ResourceParams resParams = new ResourceParams(); resParams.CallingAssembly = Assembly.GetCallingAssembly(); resParams.ExecutingAssembly = Assembly.GetExecutingAssembly(); resParams.ResourcePath = themeLocation; RegisterThemeFromStorage(storageType, resParams); }
public static void RegisterThemeFromStorage( ThemeStorageType storageType, Assembly assembly, string themeLocation) { ThemeResolutionService.RegisterThemeFromStorage(storageType, new ThemeResolutionService.ResourceParams() { CallingAssembly = Assembly.GetCallingAssembly(), ExecutingAssembly = Assembly.GetExecutingAssembly(), ResourcePath = themeLocation, UserAssembly = assembly }); }
/// <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 RegisterThemeFromStorage( ThemeStorageType storageType, ThemeResolutionService.ResourceParams resourceParams) { ThemeSource themeSource = new ThemeSource(); Assembly assembly = resourceParams.UserAssembly; if ((object)assembly == null) { assembly = resourceParams.CallingAssembly; } themeSource.CallingAssembly = assembly; themeSource.StorageType = storageType; themeSource.ThemeLocation = resourceParams.ResourcePath; themeSource.ReloadThemeFromStorage(); }