internal ImageDecoratorsList(ImageDecoratorsManager decoratorsManager, BlogPostSettingsBag settingsBag, bool addDefaultBorderDecorator) { _decoratorsManager = decoratorsManager; _decoratorsSettingsBag = settingsBag; List <ImageDecorator> decorators = new List <ImageDecorator>(); string appliedDecorators = settingsBag.GetString(APPLIED_DECORATORS, ""); //Add all of the defined decorators from the settings bag to the decoratorslist. //Bug fix note: collect decorators into an arraylist to avoid enumeration modified exception //from _decoratorsSettingsBag.SubsettingNames when calling AddDecorator(decorator); foreach (string decoratorId in appliedDecorators.Split(',')) { ImageDecorator decorator = decoratorsManager.GetImageDecorator(decoratorId); if (decorator != null) { decorators.Add(decorator); } } AddDecorator(decorators.ToArray()); if (addDefaultBorderDecorator && (BorderImageDecorator == null)) { AddDecorator(HtmlBorderDecorator.Id); } }
public void MergeDecorators(params string[] decoratorIds) { List <ImageDecorator> decorators = new List <ImageDecorator>(decoratorIds.Length); foreach (string decoratorId in decoratorIds) { ImageDecorator decorator = _decoratorsManager.GetImageDecorator(decoratorId); ImageDecoratorGroup group = _decoratorsManager.GetImageDecoratorsGroup(decorator.GroupName); if (group.MutuallyExclusive && _decoratorsList.Exists(d => d.GroupName == decorator.GroupName)) { continue; } if (!_decoratorsList.Contains(decorator)) { decorators.Add(decorator); } } AddDecorator(decorators.ToArray()); }
internal void SynchronizeImageDecorators() { ArrayList decoratorsList = new ArrayList(); foreach (string decoratorId in ImageDecoratorsList.GetImageDecoratorIds()) { ImageDecorator decorator = _decoratorsManager.GetImageDecorator(decoratorId); if (!decorator.IsHidden) { decoratorsList.Add(decorator); } } bool needsReload = false; if (decoratorsList.Count != listViewDecoratorsTable.Items.Count) { needsReload = true; } else { for (int i = 0; i < decoratorsList.Count && !needsReload; i++) { ImageDecorator decorator = (ImageDecorator)decoratorsList[i]; if (listViewDecoratorsTable.Items[i].Tag != decorator) { needsReload = true; } } } if (needsReload) { ReloadImageDecorators(); } }
internal ImageDecoratorsList(ImageDecoratorsManager decoratorsManager, BlogPostSettingsBag settingsBag, bool addDefaultBorderDecorator) { _decoratorsManager = decoratorsManager; _decoratorsSettingsBag = settingsBag; List<ImageDecorator> decorators = new List<ImageDecorator>(); string appliedDecorators = settingsBag.GetString(APPLIED_DECORATORS, ""); //Add all of the defined decorators from the settings bag to the decoratorslist. //Bug fix note: collect decorators into an arraylist to avoid enumeration modified exception //from _decoratorsSettingsBag.SubsettingNames when calling AddDecorator(decorator); foreach (string decoratorId in appliedDecorators.Split(',')) { ImageDecorator decorator = decoratorsManager.GetImageDecorator(decoratorId); if (decorator != null) { decorators.Add(decorator); } } AddDecorator(decorators.ToArray()); if (addDefaultBorderDecorator && (BorderImageDecorator == null)) AddDecorator(HtmlBorderDecorator.Id); }