Which is the recommended way of waiting for a page to load/reflow in Awesomium.NET 1.7+ when running in a non-UI environment? I've tried this approach:

using (var view = WebCore.CreateWebView(...))
{
    // Load page, resize view etc.
    // ...

    do
    {
        System.Threading.Thread.Sleep(50);
        WebCore.Update();
    } while (view.IsLoading);

    // Do something with the page
    // ...
}

However, this doesn't seem to work reliably - if I render the page to a bitmap after the loop it pretty often comes out blank (but not always). Is there a better way of waiting for page load/reflow?

有帮助吗?

解决方案 2

How you do it depends on what you are waiting for. The code in the question should work when waiting for a page to load, but resizing the view is different - check out the BitmapSurface.Resized event, it fires when the BitmapSurface has been resized and updated its buffer.

其他提示

Try subscribing to the WebView.DocumentReady event.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top