public static HtmlBoxes.HtmlHost CreateHtmlHost(AppHost appHost, EventHandler <ContentManagers.ImageRequestEventArgs> imageReqHandler, EventHandler <ContentManagers.TextRequestEventArgs> textReq) { List <HtmlBoxes.HtmlVisualRoot> htmlVisualRootUpdateList = new List <HtmlBoxes.HtmlVisualRoot>(); var config = new HtmlBoxes.HtmlHostCreationConfig() { RootGraphic = appHost.RootGfx, TextService = appHost.RootGfx.TextServices }; //1. HtmlBoxes.HtmlHost htmlhost = new HtmlBoxes.HtmlHost(config); //create html host with config appHost.RootGfx.ClearingBeforeRender += (s, e) => { // htmlhost.ClearUpdateWaitingCssBoxes(); // int j = htmlVisualRootUpdateList.Count; for (int i = 0; i < j; ++i) { HtmlBoxes.HtmlVisualRoot htmlVisualRoot = htmlVisualRootUpdateList[i]; htmlVisualRoot.RefreshDomIfNeed(); htmlVisualRoot.IsInUpdateQueue = false; } htmlVisualRootUpdateList.Clear(); }; //2. htmlhost.RegisterCssBoxGenerator(new LayoutFarm.CustomWidgets.MyCustomCssBoxGenerator(htmlhost)); //3. htmlhost.AttachEssentailHandlers(imageReqHandler, textReq); //4. htmlhost.SetHtmlVisualRootUpdateHandler(htmlVisualRoot => { if (!htmlVisualRoot.IsInUpdateQueue) { htmlVisualRoot.IsInUpdateQueue = true; htmlVisualRootUpdateList.Add(htmlVisualRoot); } }); //----------------------------------------------------------------- if (PaintLab.Svg.VgResourceIO.VgImgIOHandler == null) { var imgLoadingQ = new ContentManagers.ImageLoadingQueueManager(); imgLoadingQ.AskForImage += (s, e) => { //check loading policy here // e.SetResultImage(LoadImage(e.ImagSource)); }; PaintLab.Svg.VgResourceIO.VgImgIOHandler = (LayoutFarm.ImageBinder binder, PaintLab.Svg.VgVisualElement imgRun, object requestFrom) => { imgLoadingQ.AddRequestImage(binder); }; } return(htmlhost); }