Esempio n. 1
0
        private void chklstbCategories_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            IRSSFeed current = lstbFeedsForCategories.SelectedItem as IRSSFeed;

            if (current == null)
            {
                MessageShow.ShowMessage(this,
                                        "Please select feed from the left please before assigning category to a feed.",
                                        "Unable to continue", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            if (e.Index >= 0)
            {
                if (e.NewValue == CheckState.Checked)
                {
                    IRSSCategory cat = chklstbCategories.SelectedItem as IRSSCategory;
                    if (cat != null)
                    {
                        current.AddToCategory(cat);
                    }
                }
                else if (e.NewValue == CheckState.Unchecked)
                {
                    IRSSCategory cat = chklstbCategories.SelectedItem as IRSSCategory;
                    if (cat != null)
                    {
                        current.RemoveFromCategory(cat);
                    }
                }
            }
        }
Esempio n. 2
0
 public void RemoveFromCategory(IRSSCategory category)
 {
     if (BelongsToCategories.Contains(category))
     {
         BelongsToCategories.Remove(category);
         category.RemoveFeed(this);
     }
 }
Esempio n. 3
0
 public void AddToCategory(IRSSCategory category)
 {
     if (!BelongsToCategories.Contains(category))
     {
         BelongsToCategories.Add(category);
         category.AddFeed(this);
     }
 }
        private void SetDispalyFeeds(DisplayFeedsType type, IRSSCategory category)
        {
            RSSFeedsContainer feeds = FeedsGroup.FirstOrDefault();

            if (feeds != null)
            {
                switch (type)
                {
                case DisplayFeedsType.All:
                    DisplayFeeds     = feeds.GetFeeds().Where(feed => !feed.Disabled).ToList();
                    DisplayFeedsName = "All Feeds";
                    break;

                case DisplayFeedsType.Active:
                    DisplayFeeds = (from feed in feeds.GetFeeds()
                                    where (feed.Active && !feed.Disabled)
                                    select feed).ToList();
                    DisplayFeedsName = "All Active Feeds";
                    break;

                case DisplayFeedsType.NonActive:
                    DisplayFeeds = (from feed in feeds.GetFeeds()
                                    where (!feed.Active && !feed.Disabled)
                                    select feed).ToList();
                    DisplayFeedsName = "All Non Active Feeds";
                    break;

                case DisplayFeedsType.Privates:
                    DisplayFeeds     = feeds.GetFeeds().Where(feed => !feed.Disabled && feed.IsPersonalFeed).ToList();
                    DisplayFeedsName = "All Private Feeds";
                    break;

                case DisplayFeedsType.Disabled:
                    DisplayFeeds     = feeds.GetFeeds().Where(feed => feed.Disabled).ToList();
                    DisplayFeedsName = "All Disabled Feeds";
                    break;

                case DisplayFeedsType.NotInCategory:
                    DisplayFeeds =
                        feeds.GetFeeds().Where(feed => !feed.Disabled && feed.BelongsToCategories.Count == 0).ToList
                            ();
                    DisplayFeedsName = "All Feeds not in any Category";
                    break;

                case DisplayFeedsType.InSomeCategory:
                    if (category != null)
                    {
                        DisplayFeeds = (from feed in feeds.GetFeeds()
                                        where feed.BelongsToCategories.Contains(category)
                                        select feed).ToList();
                        DisplayFeedsName = "All Feeds in Category: " + category.CategoryName;
                    }
                    break;
                }
                // tpFeeds.Text = string.Format("Feeds Viewer (Selected Feeds: {0})", DisplayFeedsName);
            }
        }
Esempio n. 5
0
        private void btnCategoriesDelete_Click(object sender, EventArgs e)
        {
            IRSSCategory cat = chklstbCategories.SelectedItem as IRSSCategory;

            if (cat != null)
            {
                FeedsContainer.RemoveCategory(cat);
                LoadCategories();
                OnCategoriesChanged(this, new Args());
            }
        }
 public void AddCategory(IRSSCategory category)
 {
     if (Categories == null)
     {
         Categories = new BindingList <IRSSCategory>();
     }
     if (Categories.Contains(category))
     {
         var msg = string.Format("The category {0} already exists.", category.CategoryName);
         MessageShow.ShowMessage(this, msg, "Can't add category", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         Categories.Add(category);
     }
 }
        public void RemoveCategory(IRSSCategory category)
        {
            if (Categories == null)
            {
                Categories = new BindingList <IRSSCategory>();
            }

            if (category.FeedsCount > 0)
            {
                var msg = string.Format("The category {0} has {1} feeds in it. Can't delete the category", category.CategoryName, category.FeedsCount);
                MessageShow.ShowMessage(this, msg, "Can't delete category", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                Categories.Remove(category);
            }
        }
Esempio n. 8
0
 private void chklstbCategories_ItemCheck(object sender, ItemCheckEventArgs e)
 {
     if (e.Index >= 0)
     {
         if (e.NewValue == CheckState.Checked)
         {
             IRSSCategory cat = chklstbCategories.SelectedItem as IRSSCategory;
             if (cat != null)
             {
                 Feed.AddToCategory(cat);
             }
         }
         else if (e.NewValue == CheckState.Unchecked)
         {
             IRSSCategory cat = chklstbCategories.SelectedItem as IRSSCategory;
             if (cat != null)
             {
                 Feed.RemoveFromCategory(cat);
             }
         }
         OnFeedActiveStatusChanged(this, new FeedArgs(FeedsContainer[e.Index], false));
     }
 }