private void button1_Click(object sender, EventArgs e) { if (buttonStartStop.Text == "Start") { buttonStartStop.Text = "Stop"; // Start the LeadsScraper thread { LeadsScraperObject = new ProxySourceScraper(this, Global); LeadsScraperThread = new Thread(LeadsScraperObject.DoWork); LeadsScraperThread.IsBackground = true; LeadsScraperThread.Start(); } // Start the out file thread { ProxyOutToFileObject = new ProxyOutToFile(this, Global, labelOutFileTime, labelProxyOutFilePath); ProxyOutToFileThread = new Thread(ProxyOutToFileObject.DoWork); ProxyOutToFileThread.Start(); } // Tell other threds that we are runnig Global.running = true; } else { buttonStartStop.Text = "Start"; LeadsScraperObject.StopWork(); ProxyOutToFileObject.StopWork(); // Tell other threds that we are not runnig Global.running = false; } }