private void RunNews() { workerFunctionDelegate w = workerFunction; DataContainer container; string strNews = ""; using (SAController ctrlSA = new SAController()) { List <string> values = new List <string>(); // Kiem tra Session neu null thi nghi FIS.Entities.Session session; ctrlSA.GetCurrentSessionInfo(out session); int type = 0; if (session != null) { ctrlSA.ExecuteProcedureFillDataset(out container, "sp_alertlog_sel_all", values); var dsResult2 = container.DataSet; if (dsResult2.Tables[0].Rows.Count > 0) { for (int i = 0; i < dsResult2.Tables[0].Rows.Count; i++) { strNews = " Tin mới : " + dsResult2.Tables[0].Rows[i][0].ToString(); barStaticItem4.Appearance.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold); barStaticItem4.Appearance.ForeColor = System.Drawing.Color.Red; barStaticItem4.Appearance.Options.UseFont = true; barStaticItem4.Appearance.Options.UseForeColor = true; barStaticItem4.ImageIndex = 8; type = Convert.ToInt32(dsResult2.Tables[0].Rows[i][1].ToString()); w.BeginInvoke(strNews, null, null); } } else { barStaticItem4.Caption = null; barStaticItem4.ImageIndex = 99; } if (type == 1) //Call form alert { frmAlert frm = new frmAlert(); frm.Show(); } } } }
private void button1_Click(object sender, EventArgs e) { workerFunctionDelegate w = workerFunction; w.BeginInvoke(3, null, null); }