internal static bool IsMasterPageThemeColorStyleSheet(string resourceName, out MasterPageTheme masterPageTheme, out MasterPageThemeColor masterPageThemeColor) { masterPageTheme = MasterPageTheme.Standard; masterPageThemeColor = MasterPageThemeColor.Red; foreach (MasterPageTheme theme in Enum.GetValues(typeof(MasterPageTheme))) { foreach (MasterPageThemeColor themeColor in Enum.GetValues(typeof(MasterPageThemeColor))) { if (resourceName.EndsWith(GetMasterPageThemeColorStyleSheet(theme, themeColor), StringComparison.OrdinalIgnoreCase)) { masterPageTheme = theme; masterPageThemeColor = themeColor; return(true); } } } return(false); }
internal static string GetMasterPageThemeColorResource(MasterPageTheme theme, MasterPageThemeColor color, string resourceName) { return(string.Format(CultureInfo.InvariantCulture, "Images.MasterPageThemes.{0}{1}.{2}", theme, ((color == MasterPageThemeColor.NotSet) ? null : color.ToString()), resourceName)); }
private static string ProcessStyleSheet(string styleSheetContent, MasterPageTheme masterPageTheme, MasterPageThemeColor masterPageThemeColor) { string[] keyNames = null; if (masterPageTheme == MasterPageTheme.Modern) { keyNames = new string[] { "AddNew.png", "NotificationCross.png", "SearchLense.png" }; } else if (masterPageTheme == MasterPageTheme.Gradient) { keyNames = new string[] { "MainMenuBottom.gif", "MainMenuItemRight.gif", "MainMenuItemLeft.gif" , "SubmenuButtonItemMiddle.gif", "SubmenuButtonItemLeft.gif", "SubmenuButtonItemRight.gif" , "SubmenuFirstLevelItemMiddle.gif", "SubmenuFirstLevelItemLeft.gif", "SubmenuFirstLevelItemRight.gif" , "SubmenuSecondLevelItemPointer.gif" , "SubmenuLastSecondLevelItemMiddle.gif", "SubmenuLastSecondLevelItemLeft.gif", "SubmenuLastSecondLevelItemRight.gif" }; } return(ProcessStyleSheet(styleSheetContent, keyNames, ResourceProvider.GetMasterPageThemeColorResource(masterPageTheme, masterPageThemeColor, "{0}"))); }
internal static string GetMasterPageThemeColorStyleSheet(MasterPageTheme theme, MasterPageThemeColor color) { return(string.Format(CultureInfo.InvariantCulture, "Styles.MasterPageThemes.{0}{1}.css", theme, ((color == MasterPageThemeColor.NotSet) ? null : color.ToString()))); }
private static void GetEmbeddedResource(string resourceName, ref byte[] content, ref string contentType, ref string name, ref bool cacheable) { if (string.IsNullOrEmpty(resourceName)) { return; } string[] parts = resourceName.Split('?'); resourceName = parts[0]; name = GetResourceFileName(resourceName); contentType = MimeType.GetMimeType(Support.GetLastPartOfString(resourceName, ".", true), MimeType.Text); resourceName = ManifestResourceNamePrefix + "." + resourceName; MasterPageTheme masterPageTheme = MasterPageTheme.Standard; MasterPageThemeColor masterPageThemeColor = MasterPageThemeColor.Red; DetailMenuTheme detailMenuTheme = DetailMenuTheme.Standard; if (resourceName.EndsWith(CustomStyleSheet, StringComparison.OrdinalIgnoreCase)) { cacheable = false; string styleSheet = null; if (parts.Length > 0) { object obj = Support.ConvertStringToType(parts[1], typeof(Guid)); if (obj != null) { styleSheet = SettingProvider.GetCustomStyleSheet((Guid)obj); } } if (!Support.StringIsNullOrEmpty(styleSheet)) { content = UnicodeEncoding.UTF8.GetBytes(ProcessStyleSheet(styleSheet, FrameworkConfiguration.Current.WebApplication.MasterPage.Theme, FrameworkConfiguration.Current.WebApplication.MasterPage.ThemeColor)); } else { content = new byte[] { } }; } else if (resourceName.EndsWith(ComboBoxModernStyleSheet, StringComparison.OrdinalIgnoreCase)) { content = UnicodeEncoding.UTF8.GetBytes(ProcessComboBoxModernStyleSheet(GetManifestResourceString(resourceName))); } else if (IsMasterPageThemeColorStyleSheet(resourceName, out masterPageTheme, out masterPageThemeColor)) { content = UnicodeEncoding.UTF8.GetBytes(ProcessStyleSheet(GetManifestResourceString(resourceName), masterPageTheme, masterPageThemeColor)); } else if (IsDetailMenuThemeStyleSheet(resourceName, out detailMenuTheme)) { content = UnicodeEncoding.UTF8.GetBytes(ProcessStyleSheet(GetManifestResourceString(resourceName), detailMenuTheme)); } else if (resourceName.EndsWith(BootstrapStyleSheet, StringComparison.OrdinalIgnoreCase)) { content = UnicodeEncoding.UTF8.GetBytes(ProcessBootstrapStyleSheet(GetManifestResourceString(resourceName))); } else if (resourceName.EndsWith(FancyBoxStyleSheet, StringComparison.OrdinalIgnoreCase)) { content = UnicodeEncoding.UTF8.GetBytes(ProcessFancyBoxStyleSheet(GetManifestResourceString(resourceName))); } else if (resourceName.EndsWith(GlobalModernStyleSheet, StringComparison.OrdinalIgnoreCase)) { content = UnicodeEncoding.UTF8.GetBytes(ProcessStyleSheet(GetManifestResourceString(resourceName), MasterPageTheme.Modern, MasterPageThemeColor.NotSet)); } else if (resourceName.EndsWith(CommonGridViewModernStyleSheet, StringComparison.OrdinalIgnoreCase)) { content = UnicodeEncoding.UTF8.GetBytes(ProcessCommonGridViewModernStyleSheet(GetManifestResourceString(resourceName))); } else if (resourceName.EndsWith(AccountSettingsStyleSheet, StringComparison.OrdinalIgnoreCase)) { content = UnicodeEncoding.UTF8.GetBytes(ProcessAccountSettingsStyleSheet(GetManifestResourceString(resourceName))); } else if (resourceName.EndsWith(CreditCardRegistrationStyleSheet, StringComparison.OrdinalIgnoreCase)) { content = UnicodeEncoding.UTF8.GetBytes(ProcessCreditCardRegistrationStyleSheet(GetManifestResourceString(resourceName))); } else if (resourceName.EndsWith(OnOffSwitchStyleSheet, StringComparison.OrdinalIgnoreCase)) { content = UnicodeEncoding.UTF8.GetBytes(ProcessOnOffSwitchStyleSheet(GetManifestResourceString(resourceName))); } else if (resourceName.EndsWith(NoticeMessageBoxStyleSheet, StringComparison.OrdinalIgnoreCase)) { content = UnicodeEncoding.UTF8.GetBytes(ProcessNoticeMessageBoxStyleSheet(GetManifestResourceString(resourceName))); } else { content = GetManifestResourceBytes(resourceName); } }