title: Winform and threading (C#)
body: <p>I have a problem with winform application which uses threads to update the UI. My application does upload and downloading of files from cloud. Same time I am also displaying Network speed details on the same window. These three operations (upload, download, display n/w speed) are invoked by 3 different threads. Problem is, when I start download/upload, whole window  freezes and n/w speed display doesn't refresh (it is written to refresh at every 1sec interval). what would be the problem? Thanks in advance.</p>
  
  <p>Code is as follows... same way i have written for download. If I call **Upload** first and then **Download** one after the other, first thread will pause and download thread starts. once **Download** is done then **Upload** continues. Its not going in parallel. Also UI doesn't respond immediately for other button click or window resize, move actions.   </p>
  
  <pre><code>public delegate void UploadDelgt();
  UploadDelgt UpldDlgtObj;
   private void Form1_Load(object sender, EventArgs e)
  {
      UpldDlgtObj = new UploadDelgt(DoUpload);
  }
  
  public void load()
  {
      Form1 form = this;
      form.Invoke(UpldDlgtObj);
  }
  
  private void button1_Click(object sender, EventArgs e)
  {
      thrd = new Thread(new ThreadStart(load));
      thrd.Start();
      thrd.IsBackground = true;
  }
  
  public void DoUpload()
  {
  //uploads file block by block and updates the progressbar accordingly..
  }
  </code></pre>