public async Task Save(ApplicationData data)
 {
     await MockDb.Init();
     var json = JsonConvert.SerializeObject(data);
     var dataBlob = Encryption.Encrypt(Csla.ApplicationContext.User.Identity.Name, json);
     MockDb.ApplicationDataFile = dataBlob;
 }
 public async Task Save(ApplicationData data)
 {
     //TODO: user Csla.ApplicationContext.User identity info to encrypt data
     var json = JsonConvert.SerializeObject(data);
     var fileSystem = FileSystem.Current;
     var rootFolder = fileSystem.LocalStorage;
     var file = await rootFolder.CreateFileAsync("ApplicationData.txt", CreationCollisionOption.ReplaceExisting);
     await file.WriteAllTextAsync(json);
 }
 public async Task Save(ApplicationData data)
 {
     var json = JsonConvert.SerializeObject(data);
     var dataBlob = Encryption.Encrypt(Csla.ApplicationContext.User.Identity.Name, json);
     var fileSystem = FileSystem.Current;
     var rootFolder = fileSystem.LocalStorage;
     var file = await rootFolder.CreateFileAsync("ApplicationData.txt", CreationCollisionOption.ReplaceExisting);
     await file.WriteAllTextAsync(dataBlob);
 }
 public async Task<ApplicationData> Get()
 {
     //TODO: user Csla.ApplicationContext.User identity info to decrypt data
     ApplicationData result;
     var fileSystem = FileSystem.Current;
     var rootFolder = fileSystem.LocalStorage;
     var file = await rootFolder.GetFileAsync("ApplicationData.txt");
     if (file != null)
     {
         await file.OpenAsync(FileAccess.Read);
         var json = await file.ReadAllTextAsync();
         result = JsonConvert.DeserializeObject<ApplicationData>(json);
     }
     else
     {
         result = new ApplicationData();
     }
     return result;
 }
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
        public async Task Save(ApplicationData data)
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
        {
            MockDb.ApplicationData = data;
        }