clear cache in window phone 7

后端 未结 2 532
渐次进展
渐次进展 2021-01-07 00:34

I want Dipose cache in window phone 7. In my project I have download Images, after use I Dispose Image by:

Image.sou         


        
相关标签:
2条回答
  • 2021-01-07 00:51

    To remove a downloaded image from the cache you need to assign it's source to a separate BitmapImage and set that to null before setting the image's source to null.

    BitmapImage bitmapImage = image.Source as BitmapImage;
    bitmapImage.UriSource = null;
    image.Source = null;
    

    Don't ask me why, but it works.

    0 讨论(0)
  • 2021-01-07 00:59

    What you can do to enforce system to load image always from the URL is to use the following inception:

    img.source = new bitmapImage(new uri("http://diadiem.com/image/123.jpg?random=" + randomvar)...
    

    Where randomvar is a random variable like GUID.NewGuid()

    0 讨论(0)
提交回复
热议问题