i need display images remote database.here have code display images local file.but can't remote server
c#
code
dispatchertimer timer = new dispatchertimer(); list<string> files = new list<string>() { "http://technomindtech.com/1tele-pixel.com/ad/banner.jpg", "http://technomindtech.com/1tele-pixel.com/ad/logo_banner.jpg", "http://technomindtech.com/1tele-pixel.com/ad/images.jpeg" }; list<bitmapimage> images = new list<bitmapimage>(); int current = 0; foreach (string file in files) { bitmapimage image = new bitmapimage(new uri(file, urikind.relative)); images.add(image); } timer = new dispatchertimer(); timer.interval = timespan.fromseconds(3); timer.tick += new eventhandler(timer_tick); timer.start(); void timer_tick(object sender, eventargs e) { image1.source = images[current]; current++; if (current >= files.count) current = 0; }
xaml
code
<image x:name="image1" stretch="fill" width="410" grid.columnspan="3" margin="-8,0,-29,0" />
but throws uri exception can't show image
in foreach block, when creating image uri, stating path relative, absolute. so, modifying statement should work:
bitmapimage image = new bitmapimage(new uri(file, urikind.absolute));
Comments
Post a Comment