private void btnClearProxy_Click(object sender, EventArgs e) { objProxyForm = this; List <ProxyInfo> objProxyList = BaseConfig.GetBaseConfig().ProxyList; objProxyInfoListOK = new List <ProxyInfo>(); CheckingProxy objCheckingProxy = new CheckingProxy(objProxyList, objProxyForm, tbTryUrl.Text, tbCharset.Text, tbSuccessText.Text); ThreadStart checkingThreadDelegate = new ThreadStart(objCheckingProxy.ExecuteChecking); threadCount = 5; finishedThreadCount = 0; checkThreads = new Thread[threadCount]; for (int i = 0; i < threadCount; i++) { checkThreads[i] = new Thread(checkingThreadDelegate); checkThreads[i].Name = i.ToString(); checkThreads[i].Start(); } ThreadStart ojbWriteXmlDelegate = new ThreadStart(objCheckingProxy.WriteCheckedProxy); Thread objWriteThread = new Thread(ojbWriteXmlDelegate); objWriteThread.Start(); //foreach (Thread checkThread in checkThreads) //{ //} //Utility.Utility.ClearXmlProxyList(); //Utility.Utility.WriteProxyListToXml(objProxyList); }
private void btnClearProxy_Click(object sender, EventArgs e) { objProxyForm = this; List<ProxyInfo> objProxyList = BaseConfig.GetBaseConfig().ProxyList; objProxyInfoListOK = new List<ProxyInfo>(); CheckingProxy objCheckingProxy = new CheckingProxy(objProxyList, objProxyForm,tbTryUrl.Text,tbCharset.Text,tbSuccessText.Text); ThreadStart checkingThreadDelegate = new ThreadStart(objCheckingProxy.ExecuteChecking); threadCount = 5; finishedThreadCount = 0; checkThreads = new Thread[threadCount]; for (int i = 0; i < threadCount; i++) { checkThreads[i] = new Thread(checkingThreadDelegate); checkThreads[i].Name = i.ToString(); checkThreads[i].Start(); } ThreadStart ojbWriteXmlDelegate = new ThreadStart(objCheckingProxy.WriteCheckedProxy); Thread objWriteThread = new Thread(ojbWriteXmlDelegate); objWriteThread.Start(); //foreach (Thread checkThread in checkThreads) //{ //} //Utility.Utility.ClearXmlProxyList(); //Utility.Utility.WriteProxyListToXml(objProxyList); }