コード例 #1
0
ファイル: MainPage.xaml.cs プロジェクト: bendata61/anyplace
 private void writePoisByBuildingToIsolatedStorage(PoisByBuilding v, string directory)
 {
     var settings1 = IsolatedStorageFile.GetUserStoreForApplication();
     if (settings1.FileExists(directory + "/PoisByBuilding"))
     {
         settings1.DeleteFile(directory + "/PoisByBuilding");
     }
     else
     {
         settings1.CreateDirectory(directory);
     }
     using (var fileStream = settings1.OpenFile(directory + "/PoisByBuilding", FileMode.Create))
     {
         var serializer = new DataContractSerializer(typeof(PoisByBuilding));
         serializer.WriteObject(fileStream, v);
     }
 }
コード例 #2
0
ファイル: MainPage.xaml.cs プロジェクト: bendata61/anyplace
        private void ReadPoisByBuildingFromIsolatedStorage(string directory)
        {

            var settings1 = IsolatedStorageFile.GetUserStoreForApplication();
            if (settings1.FileExists(directory + "/PoisByBuilding"))
            {
                using (var fileStream = settings1.OpenFile(directory + "/PoisByBuilding", FileMode.Open))
                {
                    var serializer = new DataContractSerializer(typeof(PoisByBuilding));
                    _poisByBuilding = (PoisByBuilding)serializer.ReadObject(fileStream);
                }
            }
        }