报错指示如下:
Error 1 'System.Windows.Controls.WebBrowser' does not contain a definition for 'DocumentStream' and no extension method 'DocumentStream' accepting a first argument of type 'System.Windows.Controls.WebBrowser' could be found (are you missing a using directive or an assembly reference?)
我找了一晚上也没有找到原因在哪,好像也没有落下什么没有引入文件,在百度谷歌上找了一晚也没有找到解答,敬请高手们帮忙:
代码如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace JobOnePlusOne
{
public partial class GetPIN : Window
{
string gethtml = "";
public GetPIN(string openURL)
{
InitializeComponent();
myBrower.Navigate(openURL);
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
gethtml = gethtml + "1";
}
private void myBrower_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
if (this.myBrower.Document !=null)
{
System.IO.StreamReader getReader = new System.IO.StreamReader(myBrower.DocumentStream, System.Text.Encoding.GetEncoding("gb2312"));
gethtml = getReader.ReadToEnd();
}
}
}
}
webBrowser1.Navigated += new EventHandler<System.Windows.Navigation.NavigationEventArgs>(webBrowser1_Navigated);
void BrowserControlNavigated(object sender, NavigationEventArgs e) {
var htmlText = webBrowser1.Document.ReflectGetProperty("IHTMLDocument2_body").ReflectGetProperty("innerHTML");
}
//regex get PIN
PS:如果是Sl 直接SaveToString()