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.
Reliably waiting for page to load or reflow in Awesomium.NET 1.7+
-
31-05-2022 - |
Pergunta
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?
Solução 2
Outras dicas
Try subscribing to the WebView.DocumentReady event.
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow