I need a function that allows me to wait x seconds before doing next thing, and a function that allows me to wait until web pages have loaded before doing next thing. Here is my code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace MafiaspilletBot
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            webBrowser1.Navigate("mafiaspillet.no");
            webBrowser1.ScriptErrorsSuppressed = true;
        }
        private void button1_Click(object sender, EventArgs e)
        {
            SendData();
        }
        private void SendData()
        {
            webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("brukernavn")[0].SetAttribute("value", textBox2.Text);
            webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("passord")[0].SetAttribute("value", textBox1.Text);
            webBrowser1.Document.GetElementsByTagName("input").GetElementsByName("login_buton")[0].InvokeMember("click");
            //When the click is done I want it to wait 10 seconds and then I want it to do the DoKrims();
            DoKrims();
 
        }
        private void DoKrims()
        {
            webBrowser1.Navigate("http://mafiaspillet.no/kriminalitet3.php");
            //Here I want it to wait to the page is loaded before completing next
            webBrowser1.Document.GetElementById("submit").InvokeMember("click");
            //Here I want it to wait 3 seconds then load the next page
            webBrowser1.Navigate("http://mafiaspillet.no/kriminalitet3.php");
            //Here I want it to wait to the page is loaded before I completing next
            webBrowser1.Document.GetElementById("submit").InvokeMember("click");
        }
    }
}
As you can see in the code I explained where and what I want it do. Also I've tried System.Threading.Thread.Sleep(10000) but that just make the whole application stop for 10 seconds.
 
    