Silverlight独立存储

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

Silverlight独立存储
 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独立存储,布布扣,bubuko.com

Silverlight独立存储

上一篇:Jquery父页面和子页面的相互操作


下一篇:mysql基本常识