private void Chung_TimerTick(object sender, EventArgs e) { var chung = News.Chung(); if (chung != null && content != null) { List <int> list = new List <int>(); for (int i = 0; i < chung.Count; i++) { bool found = false; foreach (Item_NewsChung news1 in content) { if (chung[i].Equals(news1)) { found = true; break; } } if (!found) { list.Add(i); } } if (list.Count > 0) { for (int i = list.Count - 1; i >= 0; i--) { bool today = false; if (chung[i].Date.Day == DateTime.Now.Day && chung[i].Date.Month == DateTime.Now.Month && chung[i].Date.Year == DateTime.Now.Year) { today = true; } this.Send( "Thông báo chung", String.Format("{0}\n{1}", chung[i].Title, "Thông tin chi tiết vui lòng truy cập website."), today ? DateTime.Now : chung[i].Date, chung[i].Date.AddDays(14) ); } if (DifferentFound != null) { DifferentFound(this, new EventArgs()); } } } if (chung != null) { content = chung; } }
private void LoadNews_TBChung() { newsDisplayView1.ClearAllItems(); var d1 = News.Chung(); foreach (Item_NewsChung d2 in d1) { newsDisplayView1.AddItems(new Library.Controls.WinForms.NewsSummaryItem() { Title = d2.Title, Date = d2.Date, Content = d2.Content, }); } ; newsDisplayView1.DetectURL += NewsDisplayView1_DetectURL; }