SHARE
TWEET

Untitled

a guest Dec 3rd, 2011 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.ComponentModel;
  3. using System.Windows.Forms;
  4.  
  5. namespace WindowsFormsApplication2
  6. {
  7.     public partial class Form1 : Form
  8.     {
  9.         WorkLongTime wlt;
  10.         public Form1()
  11.         {
  12.             InitializeComponent();
  13.             wlt = new WorkLongTime();
  14.             wlt.Changed += new ChangedEventHandler(wlt_Changed);
  15.         }
  16.  
  17.         void wlt_Changed(object sender, EventArgs e)
  18.         {
  19.             progressBar1.Value++;
  20.         }
  21.  
  22.         private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
  23.         {
  24.             wlt.WorkLong();
  25.         }
  26.  
  27.         private void button1_Click(object sender, EventArgs e)
  28.         {
  29.             this.Text = "Started...";
  30.             backgroundWorker1.RunWorkerAsync();
  31.         }
  32.  
  33.         private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
  34.         {
  35.             this.Text = "Done";
  36.         }
  37.     }
  38. }
  39.  
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top