static void SetupImageList(AppHost host) { if (!LayoutFarm.CustomWidgets.ResImageList.HasImages) { //set imagelists var imgdic = new Dictionary <CustomWidgets.ImageName, Image>(); imgdic[CustomWidgets.ImageName.CheckBoxUnChecked] = host.LoadImage("../Data/imgs/arrow_close.png"); imgdic[CustomWidgets.ImageName.CheckBoxChecked] = host.LoadImage("../Data/imgs/arrow_open.png"); LayoutFarm.CustomWidgets.ResImageList.SetImageList(imgdic); } }
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); }
void contentMx_AskForImg(object sender, LayoutFarm.ContentManagers.ImageRequestEventArgs e) { //load resource -- sync or async? string absolutePath = _imgFolderPath + "\\" + e.ImagSource; if (!System.IO.File.Exists(absolutePath)) { return; } //load e.SetResultImage(_host.LoadImage(absolutePath)); }
void loadingQueue_AskForImg(object sender, LayoutFarm.ContentManagers.ImageRequestEventArgs e) { //load resource -- sync or async? //if we enable cache in loadingQueue (default=> enable) //if the loading queue dose not have the req img //then it will raise event to here //we can resolve the req image to specific img //eg. //1. built -in img from control may has special protocol //2. check if the req want a local file //3. or if req want to download from the network // //examples ... string absolutePath = null; if (e.ImagSource.StartsWith("built_in://imgs/")) { //substring absolutePath = _documentRootPath + "\\" + e.ImagSource.Substring("built_in://imgs/".Length); } else { absolutePath = _documentRootPath + "\\" + e.ImagSource; } if (!System.IO.File.Exists(absolutePath)) { return; } //load //lets host do img loading... //we can do img resolve or caching here e.SetResultImage(_host.LoadImage(absolutePath)); }