无故障记忆 [英] Trouble free memory

查看:82
本文介绍了无故障记忆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,起初我自我介绍,我是阿根廷的马丁,是我第一次在论坛上查询。我的英文写得不太好,所以我道歉。



我想知道是否可以帮助我解决我遇到的问题。

使用C#和Wpf。



加载图像时,第一次通过此处工作完美,第二次更长。如果你再次通过,我可以清理变量以重新运行整个代码。







Hello, at first I introduce myself, I'm Martin of Argentina, is the first time I do a query in the forum. I do not write very well in English, so I apologize.

I want to see if it is feasible to help me with a problem I have.
Using C # and Wpf.

When loading an image, the first time that passes here works perfectly, the second longer. As I can clean the variables to be re-run the entire code if you pass a second time.



void LoadImageAsyn(string uri)
               {
                   StatusPrompt.Content = "Descargando";
                   PreviewImage.Source = null;
                   bindingContext.Image = null;
                   TopContentArea.IsEnabled = false;

                   Uri u = new Uri(uri, UriKind.RelativeOrAbsolute);
                   BitmapImage img = new BitmapImage(u);
                   img.DownloadCompleted += new EventHandler(ImageDownloadCompleted);
                   img.DownloadFailed += new EventHandler<ExceptionEventArgs>(ImageDownloadFailed);
               }









试试通过添加以下内容来修复它:



img.BeginInit();

img.CacheOption = BitmapCacheOption.OnLoad;

img.EndInit();



但是tampocomefuncinó。我可以提供一点时间,并就我提出的问题给予指导。



非常感谢你。





Try to fix it by adding:

img.BeginInit ();
img.CacheOption = BitmapCacheOption.OnLoad;
img.EndInit ();

But tampocome funcinó. I can provide a little of your time and give me guidance on the problem that I present.

From already thank you very much.

推荐答案

这篇关于无故障记忆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆