異步事件

private void button4_Click(object sender, EventArgs e)
        {
            System.Threading.Thread thread = new System.Threading.Thread(
               new System.Threading.ThreadStart(AdDepartmentNumber)
               );
            thread.Start();

            timer1.Enabled = true;
            timer1.Start();   
        }
        void AdDepartmentNumber()
        {
            try
            {
               
               //執行的內容
            }
            catch (Exception ex)
            {
                //日誌
            }
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
//要執行的方法
}
相關文章
相關標籤/搜索