public JavascriptResult Execute(string script, Dictionary<string, object> properties) { var result = new JavascriptResult(properties); var external = new JavascriptExternal(result, WebFileHandler); var autoResetEvent = new AutoResetEvent(false); using (var ie = new WebBrowser()) { ie.ObjectForScripting = external; ie.DocumentCompleted += DocumentCompleted(autoResetEvent); var html = GetHtml(script); ie.DocumentText = html; while (!autoResetEvent.WaitOne(100)) { Application.DoEvents(); } } return result; }
public JavascriptResult Execute(string script, Dictionary <string, object> properties) { var result = new JavascriptResult(properties); var external = new JavascriptExternal(result, WebFileHandler); var autoResetEvent = new AutoResetEvent(false); using (var ie = new WebBrowser()) { ie.ObjectForScripting = external; ie.DocumentCompleted += DocumentCompleted(autoResetEvent); var html = GetHtml(script); ie.DocumentText = html; while (!autoResetEvent.WaitOne(100)) { Application.DoEvents(); } } return(result); }