zoukankan      html  css  js  c++  java
  • c# 线程和Invoke互操作万用代码

                thAssist = new Thread(() =>
                {
                    Invoke((ThreadStart)delegate()
                    {
                        ctlProgressBar1.Visible = true;
                        ctlProgressBar1.Start();
                    });
    
                    try
                    {
                        requestPage = WebRequest.Create(uri) as HttpWebRequest;
                        response = requestPage.GetResponse() as HttpWebResponse;
                    }
                    catch (WebException ex)
                    {
    
                    }
                    finally
                    {
                        StreamReader sr = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
                        Invoke((ThreadStart)delegate()
                        {
                            textBox1.Text = sr.ReadToEnd();
                            //ctlProgressBar1.Stop();
                            //ctlProgressBar1.Visible = false;
                        });
                    }
                });
                thAssist.Start();
  • 相关阅读:
    java中4种修饰符访问权限的区别
    Java中List的排序方法
    Hibernate事务
    @Component、@Service、@Constroller
    MySQL查看一个表的创建文本以及删除表某列的索引
    深入Session2
    Tomcat容器的Session管理
    深入Session
    使用spring mvc或者resteasy构建restful服务
    Spring MVC学习回顾
  • 原文地址:https://www.cnblogs.com/sung/p/2825316.html
Copyright © 2011-2022 走看看