使用此代码,用户必须等到所有图像都加载完毕。我想将这些图像异步加载到列表框中,这样用户就不必等待了。我怎么做?
public photos()
{
InitializeComponent();
refreshView();
}
private void refreshView()
{
string[] fileNames = storage.GetFileNames();
for (int i = 0; i < fileNames.Length; i++)
{
image = new Image();
FileStream jpegStream = storage.OpenFile(fileNames[i], FileMode.Open, FileAccess.Read);
image.Source = PictureDecoder.DecodeJpeg(jpegStream, 200, 200);
jpegStream.Dispose();
photoList.Items.Add(image);
}
}