public static CreateHtmlHost ( |
||
sampleViewport | ||
imageReqHandler | EventHandler |
|
textReq | EventHandler |
|
return |
public static HtmlBoxes.HtmlHost CreateHtmlHost(SampleViewport sampleViewport,
EventHandler<ContentManagers.ImageRequestEventArgs> imageReqHandler,
EventHandler<ContentManagers.TextRequestEventArgs> textReq)
{
HtmlBoxes.HtmlHost htmlhost = new HtmlBoxes.HtmlHost();
htmlhost.SetRootGraphics(sampleViewport.Root);
htmlhost.RegisterCssBoxGenerator(new LayoutFarm.CustomWidgets.MyCustomCssBoxGenerator(htmlhost));
htmlhost.AttachEssentailHandlers(imageReqHandler, textReq);
htmlhost.SetHtmlContainerUpdateHandler(htmlCont =>
{
sampleViewport.Root.AddToUpdateQueue(htmlCont);
});
return htmlhost;
}
}
HtmlBoxes.HtmlHost GetHtmlHost(AppHost host) { if (htmlHost == null) { htmlHost = HtmlHostCreatorHelper.CreateHtmlHost(host, //1. img request (s, e) => { //load resource -- sync or async? string absolutePath = imgFolderPath + "\\" + e.ImageBinder.ImageSource; if (!System.IO.File.Exists(absolutePath)) { return; } //load create and load bitmap e.ImageBinder.SetLocalImage(host.LoadImage(absolutePath)); }, //2. stylesheet request (s, e) => { }); } return(htmlHost); }