Пример #1
0
        static void Main(string[] args)
        {
            List <News> news = KanonierzyParser.GetNewsPageForDate(DateTime.Now.Year, DateTime.Now.Month);

            foreach (var item in news)
            {
                item.Comments = KanonierzyParser.GetCommentsPageForNews(item.Url, 1);
                break;
            }

            news.ForEach(item => System.Console.WriteLine(item.ToString()));
            System.Console.ReadKey();
        }
Пример #2
0
        private void LoadNewsList()
        {
            newsListBox.Items.Clear();

            var yearItem      = newsYearComboBox1.SelectedItem;
            var selectedMonth = newsMonthComboBox2.SelectedIndex + 1;

            int.TryParse(yearItem.ToString(), out int selectedYear);
            int.TryParse(newsPageTextBox.Text.Trim(), out int selectedPage);
            newsPageTextBox.Text = "" + (selectedPage > 0 ? selectedPage : selectedPage + 1);
            News = KanonierzyParser.GetNewsPageForDate(selectedYear, selectedMonth, selectedPage);

            if (News != null)
            {
                foreach (var item in News)
                {
                    string newsRecord = item.CreatedAt.ToString("MM/dd/yy HH:mm")
                                        + "\t" + $"{item.Title}  (comments: {item.NumberOfComments})";
                    newsListBox.Items.Add(newsRecord);
                }
            }
        }