示例#1
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;
     }
 }
示例#2
0
        /// <summary>
        /// Invalidates the node for UI repainting.
        /// </summary>
        protected void InvalidateNode()
        {
            bool yetInvalidated = false;

            if (_highlightCount > 0)
            {
                if (!FontColorHelper.StyleEqual(this.Override.NodeAppearance.FontData, FontColorHelper.HighlightStyle))
                {
                    FontColorHelper.CopyFromFont(this.Override.NodeAppearance.FontData, FontColorHelper.HighlightFont);
                    yetInvalidated = true;
                }
                if (this.ForeColor != FontColorHelper.HighlightColor)
                {
                    this.ForeColor = FontColorHelper.HighlightColor;
                    yetInvalidated = true;
                }
            }
            else if (_unreadCount > 0 || _anyUnread)
            {
                if (!FontColorHelper.StyleEqual(this.Override.NodeAppearance.FontData, FontColorHelper.UnreadStyle))
                {
                    FontColorHelper.CopyFromFont(this.Override.NodeAppearance.FontData, FontColorHelper.UnreadFont);
                    yetInvalidated = true;
                }
                if (this.ForeColor != FontColorHelper.UnreadColor)
                {
                    this.ForeColor = FontColorHelper.UnreadColor;
                    yetInvalidated = true;
                }
            }
            else
            {
                if (!FontColorHelper.StyleEqual(this.Override.NodeAppearance.FontData, FontColorHelper.NormalStyle))
                {
                    FontColorHelper.CopyFromFont(this.Override.NodeAppearance.FontData, FontColorHelper.NormalFont);
                    yetInvalidated = true;
                }
                if (this.ForeColor != FontColorHelper.NormalColor)
                {
                    this.ForeColor = FontColorHelper.NormalColor;
                    yetInvalidated = true;
                }
            }

            //check if we have new comments and merge style with that of others if needed
            if (this._itemsWithNewCommentsCount > 0 || this._anyNewComments)
            {
                if (!FontColorHelper.StyleEqual(this.Override.NodeAppearance.FontData, FontColorHelper.NewCommentsStyle))
                {
                    Font font = FontColorHelper.MergeFontStyles(FontColorHelper.CopyToFont(this.Override.NodeAppearance.FontData), FontColorHelper.NewCommentsStyle);
                    FontColorHelper.CopyFromFont(this.Override.NodeAppearance.FontData, font);
                    yetInvalidated = true;
                }
                if (this.ForeColor != FontColorHelper.NewCommentsColor)
                {
                    this.ForeColor = FontColorHelper.NewCommentsColor;
                    yetInvalidated = true;
                }
            }

            if (!yetInvalidated && this.Control != null)
            {
                this.Control.Invalidate();
            }
        }