在我的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