由于某种原因,它不执行timer2_tick功能

时间:2013-06-29 18:20:35

标签: c# timer

当点击一个按钮时,程序应该调用start timer1,timer1长17秒。然后在timer1中,它应该启动timer2,这是8secs长。由于某种原因,它不执行timer2_tick功能。

private void timer1_Tick(object sender, EventArgs e)
    {
        string[] ProxList = File.ReadAllLines("C:\\Prox.txt");

        string[] s = new string[4];            
        WinInetInterop.SetConnectionProxy(ProxList[p]);

        if (p > 3273)
            p = 0;

        s[0] = textBox1.Text;
        s[1] = textBox2.Text;
        s[2] = textBox3.Text;
        s[3] = textBox4.Text;

        try
        {
            webBrowser1.Navigate(s[txtBxNum]);

            timer2.Start();

            label1.Text = "Current Link: " + s[txtBxNum].ToString();
            label2.Text = "Current IP: " + ProxList[p].ToString();

            txtBxNum++;

            if (txtBxNum > 3)
                txtBxNum = 0;
        }
        catch { }

        p++;
    }

    private void timer2_Tick(object sender, EventArgs e)
    {
        webBrowser1.DocumentCompleted += webBrowser1_DocumentCompleted;
    }

    void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
    {
        try
        {
            webBrowser1.Document.GetElementById("skip_ad_button").InvokeMember("click");
        }
        catch { }
    }

0 个答案:

没有答案