私の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
実際のデバイスで動作していますか? –
はい、実際のデバイスのみです..私はisoストアから最初に3つの画像を追加し、選択されたイベントを使用して最初の画像を削除し、4番目の画像を追加するパノラマビューの画像をロードしました.. –