我是C# 的新手,我正在尝试使用它构建一个应用程序。
在我的应用程序中,有一个选项可以在 Web 浏览器上使用代理。我已经找到了一种在网络浏览器上使用代理的方法。它是如何工作的:用户粘贴一个 IP:端口代理,在他们点击开始按钮后,应用程序会告诉网络浏览器使用指定的代理服务器。
!问题:问题是我希望应用程序在一定时间后切换代理。
我的概念是:textbox
用户可以在其中粘贴代理列表,在用户单击开始按钮后,应用程序将告诉 Web 浏览器在第一行使用代理。
(比方说)30 秒后,它会自动切换到第二行,依此类推,直到用户点击停止按钮。
基本上,它会在一定时间后垂直切换到新行。
谢谢。
参考下面的代码
List<string> lstIpAddress = new List<string>();
int nCount = 0;
private void Form1_Load(object sender, EventArgs e)
{
timer1.Interval = 30000;
}
private void button1_Click(object sender, EventArgs e)
{
string strIp = textBox1.Text;
if (strIp.Length > 0)
{
lstIpAddress = strIp.Split(',').ToList();
for (int nlstItem = 0; nlstItem < lstIpAddress.Count; nlstItem++)
{
listBox1.Items.Add(lstIpAddress[nlstItem]);
}
//Pass the IP to Web Browser
label2.Text = listBox1.Items[nCount].ToString();
nCount++;
}
timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
timer1.Stop();
//Pass the IP to Web Browser
label2.Text = listBox1.Items[nCount].ToString();
timer1.Start();
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句