Пример #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);
        }
Пример #2
0
        public void Remove(ThreadedListViewItem lvi)
        {
            UltraTreeNodeExtended node = GetFromLVI(lvi);

            if (node == null)
            {
                return;
            }
            //
            UltraTreeNode parent = null;

            if (node.Level == 1)
            {
                parent = node.Parent;
            }
            _lviItems.Remove(lvi);
            node.Parent.Nodes.Remove(node);
            if (parent != null)
            {
                if (parent.Nodes.Count == 0)
                {
                    this.Nodes.Remove(parent);
                }
            }
        }
Пример #3
0
 public UltraTreeNodeExtended GetFromLVI(ThreadedListViewItem item)
 {
     if (!_lviItems.ContainsKey(item))
     {
         return(null);
     }
     return(_lviItems[item] as UltraTreeNodeExtended);
 }
Пример #4
0
 /// <summary>
 /// Sets the font of the list view item to the color used to denote
 /// an item that links to the user's URL.  Currently this color is
 /// Blue.
 /// </summary>
 /// <param name="item"></param>
 /// <param name="lvItem"></param>
 public void ApplyAction(INewsItem item, ThreadedListViewItem lvItem)
 {
     if (lvItem != null && item != null)
     {
         lvItem.Font      = FontColorHelper.MergeFontStyles(lvItem.Font, FontColorHelper.HighlightStyle);
         lvItem.ForeColor = FontColorHelper.HighlightColor;
     }
 }
Пример #5
0
        public void AddCommentUpdating(ThreadedListViewItem lvi)
        {
            UltraTreeNodeExtended node = GetFromLVI(lvi);

            if (node.Nodes.Count > 0)
            {
                //It already has comments => don't do anything
                return;
            }
            //
            UltraTreeNodeExtended n = new UltraTreeNodeExtended();

            n.IsCommentUpdating   = true;
            n.Override.ItemHeight = COMMENT_HEIGHT;
            node.Nodes.Add(n);
            n.Cells[0].Value = SR.GUIStatusLoadingChildItems;
        }
Пример #6
0
        public void Add(ThreadedListViewItem item)
        {
            INewsItem             ni = (INewsItem)item.Key;
            UltraTreeNodeExtended root;

            if (item.IsComment)
            {
                //IsComment
                root = GetFromLVI(item.Parent);
            }
            else
            {
                root = GetRootNode(ni.Date.ToLocalTime());
            }
            //
            UltraTreeNodeExtended n = new UltraTreeNodeExtended();

            n.NewsItem  = ni;
            n.DateTime  = ni.Date;
            n.NodeOwner = item;
            _lviItems.Add(item, n);
            root.Nodes.Add(n);
            //
            if (item.IsComment)
            {
                ConfigureComment(n, ni);
            }
            else
            {
                ConfigureArticle(n, ni);
            }
            //Comments
            if (ni.CommentCount > 0 && !item.IsComment)
            {
                n.Override.ShowExpansionIndicator = ShowExpansionIndicator.Always;
            }
            //
            if (!item.IsComment)
            {
                root.Expanded = true;
            }
        }
Пример #7
0
        public void AddRangeComments(ThreadedListViewItem pLVI, ThreadedListViewItem[] items)
        {
            this.BeginUpdate();
            //
            UltraTreeNodeExtended parent = GetFromLVI(pLVI);

            parent.Nodes.Clear();
            //
            foreach (ThreadedListViewItem item in items)
            {
                INewsItem             ni = (INewsItem)item.Key;
                UltraTreeNodeExtended n  = new UltraTreeNodeExtended();
                n.NewsItem  = ni;
                n.DateTime  = ni.Date;
                n.NodeOwner = item;
                _lviItems.Add(item, n);
                parent.Nodes.Add(n);
                //
                ConfigureComment(n, ni);
            }
            //
            this.EndUpdate();
        }