c# - How to display progress bar in windows phone 8 for images sourced from the web? -
i have list of uris of images on flickr. use gestures in windows phone toolkit display images , handle flick event. since images on web source set fine, progress bar collapses (hides) on flick since has set source of image , phone still has download , show it.
i wish display progress bar until image visible. (is using webclient useful?)
here simple video show happening. don't mind pictures, picked first thing came up.
the code below:
private void gesturelistener_flick(object sender, flickgestureeventargs e) { if (((e.angle <= 180 && e.angle >= 135) || (e.angle < 225 && e.angle > 180)) && e.direction.tostring().equals("horizontal")) { progess_bar.visibility=visibility.visible; if(index<photoslist.count-1) index++; image.source = new bitmapimage(new uri( photoslist[index].largeurl , urikind.absolute)); progess_bar.visibility = visibility.collapsed; } else if (((e.angle <= 45 && e.angle >= 0) || (e.angle < 360 && e.angle >= 315)) && e.direction.tostring().equals("horizontal")) { progess_bar.visibility = visibility.visible; if (index > 0) index--; else index = 0; image.source = new bitmapimage(new uri( photoslist[index].largeurl, urikind.absolute)); progess_bar.visibility = visibility.collapsed; } }
setting source property on image not block running thread till download completes code continue executing , progress bar invisible immediately.
if want provide true progress bar functionality you'll have manually download images , update progress bar based on progress. however, images in general not big files. better off showing sort of loading animation till image download completes.
Comments
Post a Comment