Ejemplo n.º 1
0
        private void buttonNewThread_Click(object sender, EventArgs e)
        {
            //good
            workerFunctionDelegate w = workerFunction;

            Task.Run(() => w.Invoke(11));
        }
Ejemplo n.º 2
0
        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();
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            workerFunctionDelegate w = workerFunction;

            w.BeginInvoke(3, null, null);
        }