problem in loading image packed in zip file.
Last post 05-10-2008 10:27 PM by CaCO3. 5 replies.
Sort Posts:
05-10-2008 6:41 AM
problem in loading image packed in zip file.

        public Page()
        {
            InitializeComponent();
            webClient.OpenReadCompleted += new OpenReadCompletedEventHandler(webClient_OpenReadCompleted);
            webClient.OpenReadAsync(new Uri("../Graphics.zip", UriKind.Relative));           
        }

        void webClient_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
        {
            StreamResourceInfo sri = new StreamResourceInfo(e.Result, null);
            StreamResourceInfo png = Application.GetResourceStream(sri, new Uri("Graphics/Characters/Actor1.png", UriKind.Relative));
           
            BitmapImage bmp = new BitmapImage();
            bmp.SetSource(png.Stream);

            fsa.ImageSource = bmp;
            fsa.UpdateLayout();
        }

here`re all codes.i download a zip,then load a picture packed inside it.these function successful executed,and i got a white board again.

but after i refresh my browser,the picture appeard.

why i have to refresh the browser?

CaCO3

Joined on 04-27-2008
Posts 22
05-10-2008 6:44 AM
Re: problem in loading image packed in zip file.

and another question,what`s the different between "../somefile.ext" and "..//somefile.ext"?

CaCO3

Joined on 04-27-2008
Posts 22
05-10-2008 9:49 AM
Re: Re: problem in loading image packed in zip file.
Added,the 'fsa' is a usercontrol referanced from a library,it has a internal Image control,the 'ImageSource' property pass to 'Source' property of that image control.
CaCO3

Joined on 04-27-2008
Posts 22
05-10-2008 11:52 AM
Marked as Answer
Re: problem in loading image packed in zip file.

CaCo3,

Answering your question at the top of the thread:

I have the same code working for me, without me having to refresh the browser. You can find the code here. The only difference is that I am assigning the BitmapImage straight to an Image control instead of assigning it to a user control containing an image as you have. But I don't see why that should be an issue.

Hope this helps,
Jim (http://jimmangaly.blogspot.com/)

Please MARK the replies as answers if they answered your question

http://www.identitymine.com/

Jim Mangaly

Joined on 04-21-2008
Kochi, India
Posts 108
05-10-2008 5:17 PM
Marked as Answer
Re: problem in loading image packed in zip file.

CaCO3:

and another question,what`s the different between "../somefile.ext" and "..//somefile.ext"?

 

../somefile.ext will find a file one level up from the current folder

..//somefile.ext fill find a file two levels up from the current folder.

 

 

Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

sladapter

Joined on 03-05-2008
Indiana, US
Posts 404
05-10-2008 10:27 PM
Re: problem in loading image packed in zip file.

yes that`s also work for me if i use an Image control directly,but when i use a user control,there`s the problem.

 

luckly i finally fixed it just now.the Page uses Canvas to hold the user control,and the user control use Grid to hold its Image.that caused the problem.i fix it by change Gird to Canvas.

CaCO3

Joined on 04-27-2008
Posts 22