FFImageLoading icon indicating copy to clipboard operation
FFImageLoading copied to clipboard

Events only fire once on multiple images if they have the same source

Open ahohns opened this issue 10 years ago • 3 comments

I'm not sure if this is intended behaviour, but setting a Finish event (and assumedly others) on multiple images only fires once if the images have the same source. If the images have a different source then they each fire their own Finish event.

ahohns avatar Dec 21 '15 05:12 ahohns

@ahohns I am sorry I have not clearly understood. Could you write an example?

molinch avatar Dec 21 '15 06:12 molinch

@molinch Sure:

var ImageA = new CachedImage { Source = ImageSource.FromFile("file1.jpg") };
ImageA.Finished += (sender, e) => { Console.WriteLine("ImageA Finished"); };

var ImageB = new CachedImage { Source = ImageSource.FromFile("file1.jpg") };
ImageB.Finished += (sender, e) => { Console.WriteLine("ImageB Finished"); };

var ImageC = new CachedImage { Source = ImageSource.FromFile("file2.jpg") };
ImageC.Finished += (sender, e) => { Console.WriteLine("ImageC Finished"); };

var ImageD = new CachedImage { Source = ImageSource.FromFile("file3.jpg") };
ImageD.Finished += (sender, e) => { Console.WriteLine("ImageD Finished"); };

Will Output:
ImageA Finished
ImageC Finished
ImageD Finished

ImageB never outputs because it's the same file source as ImageA.

ahohns avatar Dec 21 '15 06:12 ahohns

Yes you are right, B will wait for A to finish, and currently it won't call callbacks. It shouldn't be too difficult to change.

molinch avatar Dec 21 '15 06:12 molinch