void contentMx_ImageLoadingRequest(object sender, LayoutFarm.ContentManagers.ImageRequestEventArgs e) { ////load resource -- sync or async? //string absolutePath = documentRootPath + "\\" + e.ImagSource; //if (!System.IO.File.Exists(absolutePath)) //{ // return; //} ////load //System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(absolutePath); //e.SetResultImage(DemoBitmap.CreateFromGdiPlusBitmap(bmp)); }
void contentMx_ImageLoadingRequest(object sender, LayoutFarm.ContentManagers.ImageRequestEventArgs e) { //load resource -- sync or async? string absolutePath = documentRootPath + "\\" + e.ImagSource; if (!System.IO.File.Exists(absolutePath)) { return; } //load e.SetResultImage(DemoBase.LoadBitmap(absolutePath)); }
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 contentMx_ImageLoadingRequest(object sender, LayoutFarm.ContentManagers.ImageRequestEventArgs e) { //load resource -- sync or async? string absolutePath = imgFolderPath + "\\" + e.ImagSource; if (!System.IO.File.Exists(absolutePath)) { return; } //load System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(absolutePath); e.SetResultImage(new Bitmap(bmp.Width, bmp.Height, bmp)); }
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)); }