Silverlight独立存储

 1   private void Button_Click_1(object sender, RoutedEventArgs e)
 2         {
 3             IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication();
 4             using (Stream stream=isf.CreateFile("Weather.txt"))
 5             {
 6                 using (StreamWriter writer=new StreamWriter(stream))
 7                 {
 8                     writer.WriteLine(time.Text);
 9                     writer.WriteLine(time1.Text);
10                     writer.WriteLine(time2.Text);
11                     writer.WriteLine(time3.Text);
12                 }
13             }
14         }
View Code

 1  private void Button_Click_2(object sender, RoutedEventArgs e)
 2         {
 3             IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication();
 4             if (isf.FileExists("Weather.txt"))
 5             {
 6                 using (Stream stream = isf.OpenFile("Weather.txt", FileMode.Open))
 7                 {
 8                     using (StreamReader reader = new StreamReader(stream))
 9                     {
10                         string line = reader.ReadToEnd();
11 
12                     }
13                 }
14             }
15         }
View Code

IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication();
isf.DeleteFile("Weather.txt");

 

 

 

Silverlight独立存储,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。