解决 办法

public void SomeMethod()

        {

            var task = System.Windows.Application.Current.Dispatcher.BeginInvoke(new Action(

                () =>

                {

                   //自己要执行的语句

                    MessageBox.Show("开始");

                   

                }

            ));

            task.Completed += new EventHandler(task_Completed);

        }

        public void task_Completed(object sender, EventArgs e)

        {

//自己要执行的语句

                       MessageBox.Show("结束");     

        }

 

注意 这段代码还是在 一个线程中运行  如果在页面加进度条 还是没用的

posted on 2013-08-27 12:41  梁娜  阅读(1570)  评论(0编辑  收藏  举报