Skip to main content

Microsoft Silverlight

Answered Question The best way to retrieve images from the website containing the silverlight appRSS Feed

(0)

dietmar1982
dietmar1982

Member

Member

5 points

11 Posts

The best way to retrieve images from the website containing the silverlight app

 Hey Guys!

If I where to build a sort of Image gallery in silverlight, but I don't want to include the pictures in the silverlight app itself .

How would I go about doing this. Should I just use a httphandler to retrieve them from the server, or is there another "smarter" way?

 

Thanks in advance

bryant
bryant

Star

Star

9937 points

1,629 Posts

Silverlight MVP

Re: The best way to retrieve images from the website containing the silverlight app

Just put the full URL for the images as the ImageSource and they should load. http://yousite.com/images/imagex.jpg

You can use a downloader to get them asynchronously so that you don't cause the page to pause waiting for the image.

-- bryant

Blog | Twitter
_________________
Dont forget to click "Mark as Answer" on the post that helped you.

dietmar1982
dietmar1982

Member

Member

5 points

11 Posts

Re: Re: The best way to retrieve images from the website containing the silverlight app

 Thanks for the reply.

Maybe I should have mentioned, that i was planning on only showing people on picture at the time, so perhaps i could use the downloader to download the next couple of picture while people are looking at the first one.

Jonathan Shen – MSFT
Jonathan...

All-Star

All-Star

24939 points

2,425 Posts

Microsoft
Answered Question

Re: Re: The best way to retrieve images from the website containing the silverlight app

Hi Dietmar1982,

I would like to suggest you put these images under the ClientBin folder. We can create a folder with the name "images" under the ClientBin directory.  ClientBin folder is shared by the Silverlight project and ASP.NET. Images are put inside ClientBin and its sub folders can be visited by using relative address. In other conditions, we need to use absolute address.  For example,  http://your website/images/imagename.extension.

dietmar1982:
Maybe I should have mentioned, that i was planning on only showing people on picture at the time, so perhaps i could use the downloader to download the next couple of picture while people are looking at the first one.
 

In your condition, there is no need to use Downloader.

Best regards,

Jonathan

Jonathan Shen
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

bryant
bryant

Star

Star

9937 points

1,629 Posts

Silverlight MVP
Answered Question

Re: Re: The best way to retrieve images from the website containing the silverlight app

Using the downloader would work just fine. Probably the best way to do this would be to create the list of URL images that you need to download and then start downloading them. Each time an image finishes downloading you could then go to the next image in the list. If you're not sure you will need them all every time then you could use some sort of current index to stay an image or two ahead of the user.

Do you need some sample code to get you started?

-- bryant

Blog | Twitter
_________________
Dont forget to click "Mark as Answer" on the post that helped you.

dietmar1982
dietmar1982

Member

Member

5 points

11 Posts

Re: Re: Re: The best way to retrieve images from the website containing the silverlight app

 Thanks for the reply guys, they are are very helpful.

 

And I don't think i'll need you to post some sample code Bryant, I'm sure i can find some somewhere on the net Smile

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities