텍스트 파일에서 각 행의 이름을 읽어서 List<Image>
을 채우려고합니다. 텍스트 파일은 다음과 같습니다.텍스트 파일에서 읽을 때 응용 프로그램이 작동을 멈 춥니 다
image0
image1
image2
image
...
다음 코드는 프로그램이 완전히 중단되어 Visual Studio가 정지됩니다.
int counter = 0;
string line = string.Empty;
StreamReader file = new StreamReader("ItemFile.txt");
while ((line = file.ReadLine()) != null)
{
imageCollection.Add(new Image());
imageCollection[counter].Source = new BitmapImage(new Uri("Images/" + line + ".png", UriKind.Relative));
}
내가 생각을 WP7, 당신은 파일을 읽고 쓰려면 IsolatedStorage 메커니즘을 사용해야합니다. – ZafarYousafi
예외가 발생 했습니까? 큰 이미지의 큰 목록을로드하는 것이 느릴 것으로 예상됩니다. – Vlad
파일이 격리 된 저장소에 있으면 격리 된 저장소에서 파일을 읽어야합니다. [해당 가이드는 도움이 될 수 있습니다.] (http://www.windowsphonegeek.com/tips/all-about-wp7-isolated-storage-read-and-save-text-files) –