Preloading remote server Gif Images ?

Oct 1, 2009 at 11:34 AM

Hello, 

 

  internal void UpdateData()
        {
            FileAsset fa = this.DataContext as FileAsset;
            if (fa != null)
            {
                WebClient webClientImgDownloader = new WebClient();
                webClientImgDownloader.OpenReadCompleted +=
                    new OpenReadCompletedEventHandler(webClientImgDownloader_OpenReadCompleted);
                webClientImgDownloader.OpenReadAsync(fa.thumbnail);
            }
        }
        void webClientImgDownloader_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
        {
            this.animatedImage_Image.Source = e.Result;

i'm trying to use the AnimatedImage control to show remote server images. For what i understood about it, i must download the image before loading it to the control.

 

  internal void UpdateData()

        {
            FileAsset fa = this.DataContext as FileAsset;

            if (fa != null)
            {
                WebClient webClientImgDownloader = new WebClient();

                webClientImgDownloader.OpenReadCompleted +=

                    new OpenReadCompletedEventHandler(webClientImgDownloader_OpenReadCompleted);

                webClientImgDownloader.OpenReadAsync(fa.thumbnail);
            }
        }


        void webClientImgDownloader_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
        {

		// e.Result is a Stream obj. What now ? 
            this.animatedImage_Image.Source = e.Result;
        }

 

My question is how do i feed the obtained stream to the AnimatedImage source through code-behind ? 

 

Thank you,

Francisco

 

 

Coordinator
Oct 2, 2009 at 3:02 PM
The AnimatedImage class accepts an Uri as source input.
Jan 3, 2010 at 7:56 PM

Does this mean that the following statement from the latest documentation no longer applies?? "In contrast to the Silverlight Image Control this class is only able to load fully loaded images. Please verify that the image has been downloaded and loaded before assigning it to the control."

ImageTools looks like a great library.  I'm probably not the only one wishing there were a simple doc on using AnimatedImage via xaml i.e., step 1. download the version of the rar that contains the Controls step 2. add the namespace to the xaml step 3. show an example working <it:AnimatedImage> xaml tag with a Uri etc.

Coordinator
Jan 5, 2010 at 2:11 AM

Yes, the statement does not longer apply. I am sorry, that I have forgotten to update it.

You are absolutly right, I should add more documentation, but Its a problem for me, that I am the only contributor, and besides work, study and other projects there is not much time for this library at the moment. I hope I can update the documentation soon and add some additional howtos.

 

Jan 5, 2010 at 6:10 PM

Thank you and understood completely.  I am trying to get an animated gif to display and am not getting any error messages but also am not seeing any image.

I've added the xmlns reference to ImageTools.Controls and have the following xaml tag where

xmlns:it="clr-namespace:ImageTools.Controls;assembly=ImageTools.Controls"

<it:AnimatedImage Source="http://mydomain.com/path/image.gif"></it:AnimatedImage>

I've tried both relative and absolute URIs  Are both supported?

What else do I need to add?

Coordinator
Jan 5, 2010 at 10:14 PM
Both are supported. Have you added assembly ImageToolsIO.Gif?

Also look here: http://imagetools.codeplex.com/wikipage?title=Working%20with%20different%20image%20formats&referringTitle=Home
Jan 5, 2010 at 10:42 PM

 

 

yes ImageToolsIO.Gif is included and i am already calling ImageTools.IO.Decoders.AddDecoder<GifDecoder>(); anything else??

Coordinator
Jan 6, 2010 at 2:13 AM
U also use the latest source, right? Not the release.

Everything looks fine for me. I am in vacation at the moment and cant do more for u at the moment. I am really sorry.
Jan 6, 2010 at 5:19 PM
 
 
very latest yes and thank you for responding while on vacation and i understand yes pls don't do work while on vacation!!

On Tue, Jan 5, 2010 at 10:13 PM, malignate88 <notifications@codeplex.com> wrote:

From: malignate88

U also use the latest source, right? Not the release.

Everything looks fine for me. I am in vacation at the moment and cant do more for u at the moment. I am really sorry.

Read the full discussion online.

To add a post to this discussion, reply to this email (imagetools@discussions.codeplex.com)

To start a new discussion for this project, email imagetools@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com


Coordinator
Jan 7, 2010 at 12:31 PM
I had a last idea:

http://msdn.microsoft.com/en-us/library/cc189008(VS.95,lightweight).aspx