Exemplo n.º 1
0
        private void AddFeed(string url, int pollInterval, string customName, string username, string password)

        {
            try

            {
                Feed feed = Feed.Create(url, pollInterval, customName, username, password);

                feed.FeedRetrieved += new EventHandler <FeedRetrievedEventArgs>(feed_FeedRetrieved);

                feed.FeedUpdated += new EventHandler <FeedUpdatedEventArgs>(feed_FeedUpdated);

                feed.FeedError += new EventHandler <FeedErrorEventArgs>(feed_FeedError);

                this.feeds.Add(feed);

                feed.CheckForUpdates();
            }

            catch

            {
                // do nothing
            }
        }
Exemplo n.º 2
0
        public static List <Feed> Read()
        {
            // read feed info
            List <Feed> feeds = new List <Feed>();

            try
            {
                //Configuration configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal);
                Configuration configuration = OpenConfig();
                FeedsSection  section       = (FeedsSection)configuration.GetSection(FEED_SETTINGS_SECTION_NAME);
                if (section != null)
                {
                    foreach (FeedElement fe in section.Feeds)
                    {
                        Feed feed = Feed.Create(fe.Url, fe.PollInterval, fe.CustomName, fe.Username, fe.Password);
                        feeds.Add(feed);
                    }
                }
            }
            catch
            {
            }
            return(feeds);
        }