private void LoginButton_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(this.DomainText.Text) ||
         string.IsNullOrWhiteSpace(this.EmailText.Text) ||
         string.IsNullOrWhiteSpace(this.PasswordText.Text))
     {
         MessageBox.Show(this, "All fields are required.", "Missing fields",
             MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     TrackerWebBrowser Browser = new TrackerWebBrowser();
     Thread thread = new Thread(() =>
     {
         Browser.DoLogin(this.DomainText.Text.Trim(), this.SubdomainText.Text.Trim(), this.EmailText.Text.Trim(),
             this.PasswordText.Text.Trim());
         Application.Run();
     });
     thread.SetApartmentState(ApartmentState.STA);
     thread.Start();
     thread.Join();
     if (Browser.LoggedIn)
         this.Context.SetSessionId(Browser.SessionID, this.DomainText.Text.Trim(), this.SubdomainText.Text.Trim());
     this.Close();
 }
 public TrackerWebBrowserEventHelper(TrackerWebBrowser parent)
 {
     this.parent = parent;
 }