/// <summary> /// Initializes a new instance of the <see cref="SyndicationGenerator"/> class using the supplied <see cref="TrainSettings"/> and collection of <see cref="Category"/> objects. /// </summary> /// <param name="settings">The <see cref="TrainSettings"/> to use when generating syndication results.</param> /// <param name="categories">A collection of <see cref="Category"/> objects used to categorize the web log content.</param> public SyndicationGenerator(TrainSettings settings, List<Category> categories) { if (settings == null) { throw new ArgumentNullException("settings"); } if (categories == null) { throw new ArgumentNullException("categories"); } //------------------------------------------------------------ // Initialize class state //------------------------------------------------------------ this.Settings = settings; if (categories.Count > 0) { Category[] values = new Category[categories.Count]; categories.CopyTo(values); foreach (Category category in values) { this.Categories.Add(category); } } }
//============================================================ // CONSTRUCTORS //============================================================ #region SyndicationGenerator(TrainSettings settings, List<Category> categories) /// <summary> /// Initializes a new instance of the <see cref="SyndicationGenerator"/> class using the supplied <see cref="TrainSettings"/> and collection of <see cref="Category"/> objects. /// </summary> /// <param name="settings">The <see cref="TrainSettings"/> to use when generating syndication results.</param> /// <param name="categories">A collection of <see cref="Category"/> objects used to categorize the web log content.</param> public SyndicationGenerator(TrainSettings settings, List <Category> categories) { if (settings == null) { throw new ArgumentNullException("settings"); } if (categories == null) { throw new ArgumentNullException("categories"); } //------------------------------------------------------------ // Initialize class state //------------------------------------------------------------ this.Settings = settings; if (categories.Count > 0) { Category[] values = new Category[categories.Count]; categories.CopyTo(values); foreach (Category category in values) { this.Categories.Add(category); } } }
/// <summary> /// Occurs when the settings have been changed. /// </summary> private static void OnChanged() { //------------------------------------------------------------ // Attempt to raise the Changed event //------------------------------------------------------------ try { //------------------------------------------------------------ // Execute event handler //------------------------------------------------------------ if (TrainSettings.Changed != null) { TrainSettings.Changed(null, new EventArgs()); } } catch { //------------------------------------------------------------ // Rethrow exception //------------------------------------------------------------ throw; } }