public void SetHtmlHost(HtmlHost htmlhost)
{
this.htmlhost = htmlhost;
htmlhost.SetHtmlContainerUpdateHandler(htmlCont =>
{
var updatedHtmlCont = htmlCont as MyHtmlContainer;
if (updatedHtmlCont != null && !updatedHtmlCont.IsInUpdateQueue)
{
updatedHtmlCont.IsInUpdateQueue = true;
waitingUpdateList.Add(updatedHtmlCont);
}
});
htmlContainer = new MyHtmlContainer(htmlhost);
htmlContainer.AttachEssentialHandlers(
OnRefresh,
myHtmlContainer_NeedUpdateDom,
OnRefresh,
null);
htmlLayoutVisitor = new LayoutVisitor(this.gfxPlatform);
htmlLayoutVisitor.Bind(htmlContainer);
//-------------------------------------------------------
timer01.Interval = 20;//20ms?
timer01.Tick += (s, e) =>
{
//clear waiting
int j = waitingUpdateList.Count;
for (int i = 0; i < j; ++i)
{
var htmlCont = waitingUpdateList[i];
htmlCont.IsInUpdateQueue = false;
htmlCont.RefreshDomIfNeed();
}
for (int i = j - 1; i >= 0; --i)
{
waitingUpdateList.RemoveAt(i);
}
};
timer01.Enabled = true;
//-------------------------------------------
_htmlInputEventAdapter = new HtmlInputEventAdapter(gfxPlatform.SampleIFonts);
_htmlInputEventAdapter.Bind(htmlContainer);
//-------------------------------------------
}