Exemple #1
0
        private static async Task SaveDataRoamingAsync(BookInfo[] items)
        {
            if (!(bool)SettingStorage.GetValue("SyncBookmarks"))
            {
                return;
            }

            await fileRoamingSemaphore.WaitAsync();

            try
            {
                var f = await DataFolderRoaming.CreateFileAsync(fileName, Windows.Storage.CreationCollisionOption.ReplaceExisting);

                using (var s = (await f.OpenAsync(Windows.Storage.FileAccessMode.ReadWrite)).AsStream())
                {
                    var serializer = new System.Xml.Serialization.XmlSerializer(typeof(BookInfo[]));
                    serializer.Serialize(s, items);
                }
            }
            catch
            {
                // ignored
            }
            finally
            {
                fileRoamingSemaphore.Release();
            }
        }
Exemple #2
0
 internal static async Task <Windows.Storage.StorageFile> GetDataFileRoamingAsync()
 {
     return((Windows.Storage.StorageFile)(await DataFolderRoaming.TryGetItemAsync(fileName)));
 }