日期:2014-05-17  浏览次数:20949 次

两个线程同是对办面操作会出现假死
 delegate void delSelectMenu();
        delegate void delSetProgressBar();
        Thread thrSelectMenu = null;
        Thread thrSetProgressBar = null;
        private void ShowSelectMenu()
        {
            MytreeView.BeginInvoke(new delSelectMenu(InitMyTree));
            //this.BeginInvoke(new delSelectMenu(InitMyTree));
        }

        private void InitMyTree()
        {
            B_MENU_LIST Menu_ListBLL = new B_MENU_LIST();
            MytreeView.Nodes[0].Nodes.Clear();
            Menu_ListBLL.SelectMenu(MytreeView.Nodes[0], "00");
        }

        private void SetProgressBar()
        {
            while (true)
            {
                Thread.Sleep(100);
                if (thrSelectMenu.ThreadState == ThreadState.Stopped)
                {
                    toolStripProgressBar1.Value = 100;
                    break;
                }
                else
                {
                    if (toolStripProgressBar1.Value < 99)
                    {