在我的WP7应用程序中,我从Web上下载了200个图像并保存在独立存储中。当调试所有图像时,按队列方法加载全景视图,并且我可以查看它何时连接到PC。断开它与PC断开后,我打开应用程序和浏览图像它显示一些图像,并终止。当大量图像显示时应用程序崩溃
if (i < 150)
{
WebClient m_webClient = new WebClient();
Uri m_uri = new Uri("http://d1mu9ule1cy7bp.cloudfront.net/2012//pages/p_" + i + "/mobile_high.jpg");
m_webClient.OpenReadCompleted += new OpenReadCompletedEventHandler(webClient_OpenReadCompleted);
m_webClient.OpenReadAsync(m_uri);
}
void webClient_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
int count;
try
{
Stream stream = e.Result;
byte[] buffer = new byte[1024];
using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication())
{
//isf.Remove();
using (System.IO.IsolatedStorage.IsolatedStorageFileStream isfs = new IsolatedStorageFileStream("IMAGES" + loop2(k) + ".jpg", FileMode.Create, isf))
{
count = 0;
while (0 < (count = stream.Read(buffer, 0, buffer.Length)))
{
isfs.Write(buffer, 0, count);
}
stream.Close();
isfs.Close();
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
你能给我们一些关于你使用isolationStorage的方式的代码吗? – ChapMic 2012-03-08 12:30:22
在真实设备上运行呃? – 2012-03-08 12:39:01
是只在真实的设备中..我已经加载全景视图中的图像首先添加了3个图像从iso商店和使用选择更改事件删除第一个图像,并添加第四个图像vicecersa .. – 2012-03-08 12:41:27