Windows phone 7 在独立存储中完成存储过程之前,是否希望加载符号

Windows phone 7 在独立存储中完成存储过程之前,是否希望加载符号,windows-phone-7,silverlight-4.0,windows-phone-7.1,isolatedstorage,Windows Phone 7,Silverlight 4.0,Windows Phone 7.1,Isolatedstorage,我已经从绝对URL下载了200张图片,并存储在独立存储中。我希望在列表或堆栈面板中逐个显示。我希望堆栈面板显示加载符号,直到下载完成并将第200个图像存储在独立存储中 if (h < 150) { WebClient m_webClient = new WebClient(); Uri m_uri = new Uri("http://d1mu9ule1cy7bp.cloudfront.net/2012/me

我已经从绝对URL下载了200张图片,并存储在独立存储中。我希望在列表或堆栈面板中逐个显示。我希望堆栈面板显示加载符号,直到下载完成并将第200个图像存储在独立存储中

        if (h < 150)
        {

            WebClient m_webClient = new WebClient();

            Uri m_uri = new Uri("http://d1mu9ule1cy7bp.cloudfront.net/2012/media/catalogues/47/pages/p_" + h + "/IKEA_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());
        }

        GetImages();

    }
}
if(h<150)
{
WebClient m_WebClient=新的WebClient();
Uri m_Uri=新的Uri(“http://d1mu9ule1cy7bp.cloudfront.net/2012/media/catalogues/47/pages/p_“+h+”/IKEA_mobile_high.jpg”);
m_webClient.OpenReadCompleted+=新的OpenReadCompletedEventHandler(webClient_OpenReadCompleted);
OpenReadAsync(m_uri);
}
}
void webClient\u OpenReadCompleted(对象发送方,OpenReadCompletedEventArgs e)
{
整数计数;
尝试
{
Stream=e.结果;
字节[]缓冲区=新字节[1024];
使用(IsolatedStorageFile isf=IsolatedStorageFile.GetUserStoreForApplication())
{
//isf.Remove();
使用(System.IO.IsolatedStorage.IsolatedStorageFileStream isfs=新的IsolatedStorageFileStream(“IMAGES”+loop2(k)+“.jpg”,FileMode.Create,isf))
{
计数=0;
而(0<(count=stream.Read(buffer,0,buffer.Length)))
{
写入(缓冲区,0,计数);
}
stream.Close();
isfs.Close();
}
}
}
捕获(例外情况除外)
{
Show(例如ToString());
}
GetImages();
}
}

}

如果您只想显示这个长时间运行的任务的进度,那么只需添加一个
ProgressBar
。将其
最小值
设置为0,将
最大值
设置为200(或无论您要下载多少个图像),然后当每个图像下载报告完成时,只需将ProgressBar的
增加1即可

一旦下载了所有图像(即值==最大值),您就知道可以删除加载指示器


您可能还应该考虑为用户提供一种取消下载的方法,以及您是否真的必须下载所有图像才能使用该应用。

我想在我的页面中显示进度条并显示完成下载过程的百分比,直到所有图像下载到独立的存储中为止。我已经下载了上面显示的代码的图像。