public void UnBind() { _drawBoard = null; _htmlVisualRoot = null; }
public void Bind(HtmlVisualRoot htmlVisualRoot, DrawBoard drawBoard) { _htmlVisualRoot = htmlVisualRoot; _drawBoard = drawBoard; }
public void Unbind() { _htmlVisualRoot = null; _isBinded = false; }
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); }
public void Bind(HtmlVisualRoot htmlVisualRoot) { _htmlVisualRoot = htmlVisualRoot; _isBinded = htmlVisualRoot != null; _textService = htmlVisualRoot.GetTextService(); }