爲什麼我的應用程序掛起,直到WebBrowserDocumentCompleted完成加載頁面?在這段時間內我能做些什麼來保持我的應用程序響應?應用掛起等待WebBrowser控件完成
停用的預訂 「
DocumentCompleted
」
程序的方法wb.Navigate ("http:// ....");
Can you post some code to show us what you have done?
單擊按鈕時也會凍結和網頁
private void ButtonStart_Click(object sender, EventArgs e)
{
if (this.settingsForm.tEmail.Text == "" || this.settingsForm.tPassword.Text == "")
{
MessageBox.Show("Отсутствует логин и\\или пароль для входа на сервер МосВара.\nВвести их можно, нажав на кнопку \"Настройки\".", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Hand);
return;
}
wb.Navigate("http://www.moswar.ru");
}
事件處理
private void wb_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
//if (e.Url.AbsolutePath != (sender as WebBrowser).Url.AbsolutePath) return;
if (wb.Document.GetElementById("login-email") != null)
{
wb.Document.GetElementById("login-email").InnerText = settingsForm.tEmail.Text;
wb.Document.GetElementById("login-password").InnerText = settingsForm.tPassword.Text;
GetElementsByClassName(new string[] {"button luxury"})[0].InvokeMember("click");
}
if (e.Url.AbsoluteUri == "http://www.moswar.ru/player/" || e.Url.AbsoluteUri == "http://www.moswar.ru/player/#login")
{
wb.Navigate("http://www.moswar.ru/metro/");
}
}
你可以張貼一些代碼來告訴我們你做了什麼? –
嘗試設置代理服務器爲NULL,它自己的線程 – Venson
好還是瀏覽器中運行,請張貼代碼先生 –