文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>C# winform 登陆等待中. [异步请求]BackgroundWorker组件的使用

C# winform 登陆等待中. [异步请求]BackgroundWorker组件的使用

时间:2011-05-26  来源:青瓷

 private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker worker = sender as BackgroundWorker;
            int result = 0;
            for (int i = 0; i < 100000; i++)
            {
                result += i;
            }
            System.Threading.Thread.Sleep(3000);
            e.Result = result;


        }

        private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {

        }

        private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            label1.Text =e.Result.ToString();
           
        }

        private void button1_Click(object sender, EventArgs e)
        {
            label1.Text = "正在登陆中.....";
            button1.Enabled = false;

            backgroundWorker1.RunWorkerAsync();
          
        }

相关阅读 更多 +
排行榜 更多 +
找茬脑洞的世界安卓版

找茬脑洞的世界安卓版

休闲益智 下载
滑板英雄跑酷2手游

滑板英雄跑酷2手游

休闲益智 下载
披萨对对看下载

披萨对对看下载

休闲益智 下载