I'm using the WPF 3.5SP1 WebBrowser control to display a page containing some javascript functions. My program then needs to invoke a javascript function which will make an asynchronous call. I need a way to get the result of that asynchronous call back to C# so I can process the result.
Is there a way I can make the first javascript function sleep until something happens (with out locking up the browser)?
edit: I am already using a call back - the 2nd function is actually called "some-async-function-complete". It gets called when the async event finishes. Now I need a way to get the result into C#.
For further clarification: C#
var result = WebBrowser.InvokeScript("myscript")
JavaScript
var result;
function myscript()
{
some-async-function();
/* what goes here? */
/* wait until result != null */
return result;
}
function some-async-function-complete(retval)
{
result = retval;
}