winform调用awesominum控件报错求助
net吧
全部回复
仅看楼主
level 1
muzico425 楼主
这是programs文件
namespace WebCaptureSolution
{
static class Program
{
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
WebCapture form = new WebCapture();
form.KeyWord = args[0];
form.SavePath = args[1];
form.Show();
}
}
}
--------------------------------------------------------
这是被调用的代码
namespace WebCaptureSolution
{
public partial class WebCapture : Form
{
public string KeyWord { get; set; }
public string SavePath { get; set; }
public bool DocumentOK { get; set; }
public WebCapture()
{
InitializeComponent();
}
private void WebCapture_Load(object sender, EventArgs e)
{
this.webControl1.Source = new Uri("http://www.yahoo.co.jp");
string keyword = KeyWord;
DateTime startTime = DateTime.Now;
this.DocumentOK = false;
while ((DateTime.Now - startTime).TotalMilliseconds < 10000)
{
Application.DoEvents();
if (this.webControl1.IsDocumentReady)
{
var inputEl = this.webControl1.ExecuteJavascriptWithResult("document.getElementById('srchtxt')");
if (inputEl.ToString() != "null")
{
this.webControl1.ExecuteJavascriptWithResult(string.Format("document.getElementById('srchtxt').setAttribute('value','{0}')", keyword));
this.DocumentOK = true;
break;
}
}
if (this.DocumentOK)
{
this.DocumentOK = false;
var form = this.webControl1.ExecuteJavascriptWithResult("document.getElementsByName('sf1')[0].submit()");
while ((DateTime.Now - startTime).TotalMilliseconds < 5000)
{
Application.DoEvents();
}
startTime = DateTime.Now;
while ((DateTime.Now - startTime).TotalMilliseconds < 10000)
{
Application.DoEvents();
if (this.webControl1.IsDocumentReady)
{
var div = this.webControl1.ExecuteJavascriptWithResult("document.getElementById('wrapper')");
string html = this.webControl1.HTML;
break;
}
}
}
}
}
}
}
2015年10月16日 02点10分 1
level 1
muzico425 楼主
为什么报这个错啊
2015年10月16日 02点10分 2
1