Exemple #1
0
        public static void Load(ArticlesConsumer consumer)
        {
            Console.WriteLine("Enter query string (e.g. \"Micheal\", without quotes");
            string queryString = Console.ReadLine();

            Console.WriteLine("Enter articles count (leave empty for default count)");
            string countStr = Console.ReadLine();
            int? articlesCount;

            if (countStr != "")
            {
                articlesCount = int.Parse(countStr);
            }
            else
            {
                articlesCount = null;
            }

            if (articlesCount == null)
            {
                ArticlesCollection articles = consumer.GetArticles(queryString);
                PrintArticles(articles);
            }
            else
            {
                ArticlesCollection articles = consumer.GetArticles(queryString, (int)articlesCount);
                PrintArticles(articles);
            }
        }
        static void Main(string[] args)
        {
            ArticlesConsumer consumer = new ArticlesConsumer("http://api.feedzilla.com/");

            UI.Load(consumer);
        }