예제 #1
0
 public void RemoveFeed(Feed feed)
 {
     feed.FeedRetrieved -= feed_FeedRetrieved;
     feed.FeedUpdated -= feed_FeedUpdated;
     this.feeds.Remove(feed);
     feed.Dispose();
     feed = null;
 }
예제 #2
0
 public void AddFeed(Feed feed)
 {
     AddFeed(feed.Url, feed.PollInterval, feed.CustomName, feed.Username, feed.Password);
 }
예제 #3
0
 public void AddFeed(Feed feed)
 {
     AddFeed(feed.Url, feed.PollInterval, feed.CustomName, feed.Username, feed.Password);
 }
예제 #4
0
        void FeedListView_DrawItem(object sender, DrawListViewItemEventArgs e)
        {
            if (this.View == View.Tile)
            {
                Feed feed = (Feed)e.Item.Tag;

                // draw the background and focus rectangle for selected and non-selected states
                e.DrawBackground();
                if (e.Item.Selected)
                {
                    e.Graphics.FillRectangle(System.Drawing.Brushes.LightGray, e.Bounds);
                    ControlPaint.DrawFocusRectangle(e.Graphics, e.Bounds);
                }

                // draw icon
                int newX = e.Bounds.Left;

                /*
                 * System.Drawing.Image img = this.imageList.Images[e.Item.ImageKey];
                 * if (img != null)
                 * {
                 *  int x = e.Bounds.Left;
                 *  int y = e.Bounds.Top;
                 *  e.Graphics.DrawImage(img, x, y);
                 *  newX = e.Bounds.Left + img.Width + this.Margin.Right;
                 *  img.Dispose();
                 * }
                 * */

                // draw main text
                System.Drawing.RectangleF   rect = new System.Drawing.RectangleF(newX, e.Bounds.Top, e.Bounds.Right - newX, e.Item.Font.Height);
                System.Drawing.StringFormat sf   = new System.Drawing.StringFormat();
                sf.Trimming    = System.Drawing.StringTrimming.EllipsisCharacter;
                sf.FormatFlags = System.Drawing.StringFormatFlags.NoClip;
                System.Drawing.SolidBrush foreBrush = new System.Drawing.SolidBrush(e.Item.ForeColor);
                using (foreBrush)
                {
                    e.Graphics.DrawString(feed.Name,
                                          e.Item.Font,
                                          foreBrush,
                                          rect,
                                          sf);
                }

                // draw subitems
                System.Drawing.Color      subColor = System.Drawing.Color.FromArgb(System.Drawing.SystemColors.GrayText.ToArgb());
                System.Drawing.SolidBrush subBrush = new System.Drawing.SolidBrush(subColor);
                using (subBrush)
                {
                    for (int i = 1; i < this.Columns.Count; i++)
                    {
                        if (i < e.Item.SubItems.Count)
                        {
                            rect.Offset(0, e.Item.Font.Height);
                            e.Graphics.DrawString(e.Item.SubItems[i].Text,
                                                  e.Item.Font,
                                                  subBrush,
                                                  rect,
                                                  sf);
                        }
                    }
                }
            }
            else
            {
                e.DrawDefault = true;
            }
        }