Pessoal, minha aplicação cria um webbrowser, porém a execução não continua para demais comandos .. Por que será? Segue explicação melhor abaixo...
switch (e.CommandName)
{ case "Confirmar1":
//POST LOGIN
PostLogin();
AtualizaStatus();
}
break;
Obs::: Após execução do método PostLogin, o método AtualizaStatus não é executado...
Será que é por causa de thread?
Método PostLogin:
private void PostLogin() {
bool visible = true;
AutoResetEvent resultEvent = new AutoResetEvent(false);
//Obter as Credenciais de Login
BLIEBrowser objBLIEBrowser = new BLIEBrowser("Login", Session["Usuario"].ToString(), Session["Senha"].ToString(), resultEvent);
objBLIEBrowser.InicializaThread(visible);
// wait for the third thread getting result and setting result event
EventWaitHandle.WaitAll(new AutoResetEvent[] { resultEvent });
// the result is ready later than the result event setting somtimes
while (objBLIEBrowser.WebBrowser == null || objBLIEBrowser.WebBrowser.HtmlResult == null) Thread.Sleep(5); }
------------------
public void InicializaThread(bool pbolVisible)
{ thrd = new Thread(new ThreadStart(
delegate { Init(pbolVisible);
System.Windows.Forms.Application.Run(this);
}));
// Set thread to STA state before starting
thrd.SetApartmentState(ApartmentState.STA);
thrd.Start();
}