Ejemplo n.º 1
0
 public bool Add(FeedSubscription subscription)
 {
     if (!this.Dictionary.ContainsKey(subscription.Url))
     {
         base.Add(subscription);
         return true;
     }
     return false;
 }
Ejemplo n.º 2
0
Archivo: Feed.cs Proyecto: w0pr/blizztv
        public Feed(FeedSubscription subscription)
            : base(subscription.Name)
        {
            this.Text = subscription.Name;
            this.Url = subscription.Url;

            this.Icon = new NodeIcon("feed", Assets.Images.Icons.Png._16.feed);

            this.Menu.Add("markasread", new ToolStripMenuItem(i18n.MarkAsRead, Assets.Images.Icons.Png._16.read, new EventHandler(MenuMarkAllAsReadClicked)));
            this.Menu.Add("markasunread", new ToolStripMenuItem(i18n.MarkAsUnread, Assets.Images.Icons.Png._16.unread, new EventHandler(MenuMarkAllAsUnReadClicked)));
        }
Ejemplo n.º 3
0
        // Tries parsing a drag & dropped link to see if it's a feed and parsable.
        public override bool AddSubscriptionFromUrl(string link)
        {
            if (Subscriptions.Instance.Dictionary.ContainsKey(link))
            {
                MessageBox.Show(string.Format(i18n.FeedSubscriptionAlreadyExists, Subscriptions.Instance.Dictionary[link].Name), i18n.SubscriptionExists, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return true;
            }

            var feedSubscription = new FeedSubscription { Name = "test-feed", Url = link };

            using (var feed = new Feed(feedSubscription))
            {
                if (!feed.IsValid()) return false;

                string feedName = "";
                if (InputBox.Show(i18n.AddNewFeedTitle, i18n.AddNewFeedMessage, ref feedName) != DialogResult.OK) return true;
                feedSubscription.Name = feedName;

                if (Subscriptions.Instance.Add(feedSubscription)) this.MenuRefresh(this, new EventArgs());
            }

            return true;
        }
Ejemplo n.º 4
0
        public void ConsumeSubscription(string entryUrl)
        {
            Match match = this._subscriptionConsumerRegex.Match(entryUrl);
            if (!match.Success) return;

            string name = match.Groups["Name"].Value;
            string url = match.Groups["Url"].Value;

            var subscription = new FeedSubscription {Name = name, Url = url};
            Subscriptions.Instance.Add(subscription);
        }