public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { if (context == null) { return(new TypeConverter.StandardValuesCollection(new ArrayList())); } Control instance = context.Instance as Control; ArrayList values = new ArrayList(); if ((instance != null) && (instance.Site != null)) { IThemeResolutionService service = (IThemeResolutionService)instance.Site.GetService(typeof(IThemeResolutionService)); ThemeProvider stylesheetThemeProvider = service.GetStylesheetThemeProvider(); ThemeProvider themeProvider = service.GetThemeProvider(); if (stylesheetThemeProvider != null) { values.AddRange(stylesheetThemeProvider.GetSkinsForControl(instance.GetType())); values.Remove(string.Empty); } if (themeProvider != null) { foreach (string str in themeProvider.GetSkinsForControl(instance.GetType())) { if (!values.Contains(str)) { values.Add(str); } } values.Remove(string.Empty); } values.Sort(); } return(new TypeConverter.StandardValuesCollection(values)); }
private string GenerateUserControlHashCode(string contents, IThemeResolutionService themeService) { string str = contents.GetHashCode().ToString(CultureInfo.InvariantCulture); if (themeService != null) { ThemeProvider stylesheetThemeProvider = themeService.GetStylesheetThemeProvider(); if (stylesheetThemeProvider != null) { str = str + "|" + stylesheetThemeProvider.ContentHashCode.ToString(CultureInfo.InvariantCulture); } } return str; }
private string GenerateUserControlCacheKey(string userControlPath, IThemeResolutionService themeService) { string str = userControlPath; if (themeService != null) { ThemeProvider stylesheetThemeProvider = themeService.GetStylesheetThemeProvider(); if ((stylesheetThemeProvider != null) && !string.IsNullOrEmpty(stylesheetThemeProvider.ThemeName)) { str = str + "|" + stylesheetThemeProvider.ThemeName; } } return str; }
public override bool GetStandardValuesSupported(ITypeDescriptorContext context) { ThemeProvider themeProvider = null; if (context != null) { Control instance = context.Instance as Control; if ((instance != null) && (instance.Site != null)) { IThemeResolutionService service = (IThemeResolutionService)instance.Site.GetService(typeof(IThemeResolutionService)); if (service != null) { themeProvider = service.GetThemeProvider(); if (themeProvider == null) { themeProvider = service.GetStylesheetThemeProvider(); } } } } return(themeProvider != null); }