本文介绍了从列表框中检查代理的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个列表框,其中有一个代理列表.我有四个与此有关的按钮.他们可以找到,加载,保存和检查

So i have a listbox that i have there for a list of proxies. I have 4 buttons pertaining to it. they are find, load, save and check

我已经完成了前3个工作,但是我没有发现任何有关代理检查的有用信息,我发现每个代理仅花费了6秒,因此花了很多时间来准备一个像样的清单.

I have the first 3 finished and working but i haven't found anything useful pertaining to checking the proxies, the only one that i found took like 6 seconds per proxy so it took a lot of time for a decent sized list.

所以我怎么能保证按一下该按钮,它将检查列表框中的所有代理,并删除慢速代理,而那些缓慢的代理则不起作用.并以适当的速度执行此操作(因此它可能是多线程的)

So how could i make it that on the press of that button, it checks all of the proxies in the listbox and it deletes the slow ones and the ones that flat out do not work. and does this at a decent pace(so it would probably be multi threaded)

并且由于我无法弄清楚这一点,所以我没有与此相关的代码,除了按钮单击的子项之外,我认为没有必要发布代码

and since i can not figure this out i have no code pertaining to this except for the sub for the button click i do not feel there is a need to post code

推荐答案

我对您的建议是:

1)使用计时器控件并将其Tick属性设置为适当的值,例如500;

1)use a timer control and set it's Tick property to an appropriate value such 500;

2)创建一个BackGroudWorkers数组,例如BackGroudWorker [20];

2) create an array of BackGroudWorkers for example BackGroudWorker[20];

3)当您的应用程序开始在数组中运行所有BackGroudWorkers并在Timer的滴答事件中运行时,请检查此BackGroudWorker中的任何一个是否已完成.如果已完成,并且列表中还有其他项目,请使用新的项目运行它,直到所有列出已检查的项目

3)when your app start run all BackGroudWorkers in array and in tick event of Timer check if any of this BackGroudWorker completed or not.If completed and you have other item in list then run it with new Item.Do this until all list Items checked

这篇关于从列表框中检查代理的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 23:24