Пример #1
0
 async public void WriteBookmarks()
 {
     Windows.Storage.StorageFolder localFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
     try
     {
         var serializer = new JsonSerializer();
         using (var bookmarkStream = await localFolder.OpenStreamForWriteAsync("bookmarks.json", Windows.Storage.CreationCollisionOption.ReplaceExisting))
             using (var sr = new StreamWriter(bookmarkStream))
                 using (var jsonTextWriter = new JsonTextWriter(sr))
                 {
                     serializer.Serialize(jsonTextWriter, Bookmarks);
                 }
     }
     catch { }
 }
        public static async void Save(string FileName, MasterDictionary data)
        {
            Windows.Storage.StorageFolder storageFolder = Windows.Storage.ApplicationData.Current.LocalFolder;

            //await storageFolder.RenameAsync("LearnerToolsFolder");
            //System.Diagnostics.Debug.WriteLine(storageFolder.Path);

            using (var Stream = await storageFolder.OpenStreamForWriteAsync(FileName, Windows.Storage.CreationCollisionOption.ReplaceExisting))
            {
                System.Runtime.Serialization.DataContractSerializer Serializer = new System.Runtime.Serialization.DataContractSerializer(typeof(List <MasterDictionary>));

                Serializer.WriteObject(Stream, data);
            }



            //Windows.Storage.StorageFile File = await storageFolder.CreateFileAsync(FileName, Windows.Storage.CreationCollisionOption.ReplaceExisting);
        }