我正在尝试编写一个Windows Phone程序,我已经得到了以下代码部分:
private void b_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
WebBrowser b = sender as WebBrowser;
string response = b.DocumentText;
// looks in the page source to find the authenticity token.
// could also use regular exp<b></b>ressions here.
int index = response.IndexOf("authenticity_token");
int startIndex = index + 41;
string authenticityToken = response.Substring(startIndex, 40);
// unregisters the first event handler
// adds a second event handler
b.DocumentCompleted -= new WebBrowserDocumentCompletedEventHandler(b_DocumentCompleted);
b.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(b_DocumentCompleted2);
// format our data that we are going to post to the server
// this will include our post parameters. They do not need to be in a specific
// order, as long as they are concatenated together using an ampersand ( & )
string postData = string.Format("authenticity_token={2}&session[username_or_email]={0}&session[password]={1}&commit={3}", username, password, authenticityToken, commit);
ASCIIEncoding enc = new ASCIIEncoding();
// we are encoding the postData to a byte array
b.Navigate("https://twitter.com/sessions", "", enc.GetBytes(postData), "Content-Type: application/x-www-form-urlencoded\r\n");
}
但是,在本节的第一行,我收到以下错误:
The type or namespace name 'WebBrowserDocumentCompletedEventArgs' could not be found (are you missing a using directive or an assembly reference?)
我已尝试在最后一小时添加DLL并在网上搜索,但找不到任何解决方案。有人可以帮忙吗?