/// <summary> /// Determines whether the specified style infos contains style. /// </summary> /// <param name="styleInfos">The style infos.</param> /// <param name="styleInfo">The style info.</param> /// <returns> /// <c>true</c> if the specified style infos contains style; otherwise, <c>false</c>. /// </returns> /// <remarks>Documented by Dev02, 2008-01-21</remarks> private static bool ContainsStyle(List<StyleInfo> styleInfos, StyleInfo styleInfo) { foreach (StyleInfo si in styleInfos) { if (SameStyle(si, styleInfo)) return true; } return false; }
/// <summary> /// Determines whether the specified style infos are considered to be equal. /// </summary> /// <param name="styleInfo1">The style info 1.</param> /// <param name="styleInfo2">The style info 2.</param> /// <returns></returns> /// <remarks>Documented by Dev02, 2008-01-21</remarks> private static bool SameStyle(StyleInfo styleInfo1, StyleInfo styleInfo2) { return styleInfo1.Path.ToLower() == styleInfo2.Path.ToLower(); }
/// <summary> /// Adds the default print styles. /// </summary> /// <param name="style">The style.</param> /// <remarks>Documented by Dev02, 2008-01-21</remarks> public static void AddDefaultPrintStyles(Style style, System.Resources.ResourceManager ResourceManager) { StyleInfo info = new StyleInfo(); info.resourceManager = ResourceManager; info.Path = @"System\Print\default.xsl"; string infoname = ResourceManager.GetString("PRINT_STYLE_PRINTALL"); info.Name = string.IsNullOrEmpty(infoname) ? "Print All" : infoname; info.ResourceID = "PRINT_STYLE_PRINTALL"; if (!ContainsStyle(style.PrintStyles, info)) style.PrintStyles.Add(info); info = new StyleInfo(); info.resourceManager = ResourceManager; info.Path = @"System\Print\withoutMedia.xsl"; infoname = ResourceManager.GetString("PRINT_STYLE_WITHOUTMEDIA"); info.Name = string.IsNullOrEmpty(infoname) ? "Print without Media" : infoname; info.ResourceID = "PRINT_STYLE_WITHOUTMEDIA"; if (!ContainsStyle(style.PrintStyles, info)) style.PrintStyles.Add(info); }