Exemple #1
0
        /// <summary>
        /// Apply all filters to the specified INewsItem.
        /// </summary>
        public bool Apply(ThreadedListViewItem lvItem)
        {
            INewsItem item = lvItem.Key as INewsItem;

            if (item == null)
            {
                return(false);
            }

            bool anyApplied = false;

            foreach (string key in filters.Keys)
            {
                INewsItemFilter filter = filters[key];
                if (filter != null && filter.Match(item))
                {
                    if (!CancelFilterAction(key))
                    {
                        filter.ApplyAction(item, lvItem);
                        anyApplied = true;
                    }
                }
            }
            return(anyApplied);
        }
Exemple #2
0
        /// <summary>
        /// Apply a specific filter to the specified INewsItem.
        /// </summary>
        /// <param name="key"></param>
        /// <param name="item">The INewsItem instance</param>
        public bool Apply(string key, INewsItem item)
        {
            bool anyApplied = false;

            if (!filters.ContainsKey(key))
            {
                return(anyApplied);
            }
            INewsItemFilter filter = filters[key];

            if (filter.Match(item))
            {
                if (!CancelFilterAction(key))
                {
                    filter.ApplyAction(item, null);
                    anyApplied = true;
                }
            }
            return(anyApplied);
        }