將數據寫入文件:
IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication();
//create new file
using (StreamWriter writeFile = new StreamWriter(new IsolatedStorageFileStream("myFile.txt", FileMode.Create, FileAccess.Write, myIsolatedStorage)))
{
string someTextData = "This is some text data to be saved in a new text file in the IsolatedStorage!";
writeFile.WriteLine(someTextData);
writeFile.Close();
}
讀數據從文件:
IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication();
IsolatedStorageFileStream fileStream = myIsolatedStorage.OpenFile("myFile.txt", FileMode.Open, FileAccess.Read);
using (StreamReader reader = new StreamReader(fileStream))
{
//Visualize the text data in a TextBlock text
this.text.Text = reader.ReadLine();
}
通過這個鏈接:http://www.geekchamp.com/tips/all-about-wp7-isolated-storage-read-and-save-text-files
https://www.google.co.in/#q=wp8+isolated+storage+geek
你明白了什麼,當你'等待wr.WriteLineAsync( 「你好」);'?我的猜測是你沒有看到任何東西,因爲你在編寫任何東西之前關閉了你的Streamwriter。 – 2014-12-02 10:57:27
看到我的答案在這裏:http://stackoverflow.com/questions/27166253/windows-phone-8-choose-text-file-c-sharp/27168118#27168118它被許多人回答了很多次。 – 2014-12-02 11:10:35
我認爲你必須先谷歌它。有很多幫助。 – 2014-12-02 11:15:51