I am going to make a facebook applications in c#. I extract group ids to textbox4.Text and i want to go to all website 2 seconds to 2 seconds.. it means 1 website display 2 seconds after 2 seconds it will redirect to another website...
I use timer to get 2 seconds duration and I want to go to all website using a loop or something.. I use for loop for that but it is not printing all website. it prints only website in last...
Here i extract group IDs this is working no problem
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
richTextBox1.Text = webBrowser1.DocumentText;
textBox3.Text = string.Join(Environment.NewLine,
richTextBox1.Text.Split('/', ' ', '?')
.Where(m => m.Length > 14 && m.All(char.IsDigit)));
label3.Text = (textBox3.Lines.Length).ToString()+" Groups";
}
problem is following code when i am going to launch these one by one.
private void button2_Click(object sender, System.EventArgs e)
{
textBox3.Text = string.Join(Environment.NewLine,
richTextBox1.Text.Split('/', ' ', '?')
.Where(m => m.Length > 14 && m.All(char.IsDigit)));
}
IEnumerator<string> websites;
private void button3_Click(object sender, System.EventArgs e)
{
textBox4.Text = textBox3.Text;
string[] groups = textBox4.Text.Split('\n');
for (int i = 0; i < textBox3.Lines.Length; i++)
{
websites = new List<string> {"https://mbasic.facebook.com/groups/"+groups[i]}.GetEnumerator();
timer1.Enabled = true;
websites.MoveNext();
}
}
private void timer1_Tick(object sender, EventArgs e)
{
webBrowser1.Navigate(websites.Current);
timer1.Enabled = websites.MoveNext();
}
Please anybody fix this issues.