public async void transferAsync(myItem item) { this._id = item.id; title = item.title; description = item.description; imgSize = item.imgSize; date = item.date; selected = item.selected; img = await DataService.GetProfilePictureAsync(_id); }
private async void saveAsync() { List <string> L = new List <string>(); var allitems = ViewModel.AllItems; foreach (var item in allitems) { Models.myItem myitem = new Models.myItem(item); Debug.WriteLine(item); L.Add(JsonConvert.SerializeObject(myitem)); } StorageFolder pictureFolder = await ApplicationData.Current.LocalFolder.GetFolderAsync("ProfilePictures"); var file = await pictureFolder.CreateFileAsync("file", CreationCollisionOption.ReplaceExisting); string str = JsonConvert.SerializeObject(L); byte[] content = System.Text.Encoding.ASCII.GetBytes(str); using (var stream = await file.OpenStreamForWriteAsync()) { await stream.WriteAsync(content, 0, content.Length); } }
public TodoItem(myItem item) { transferAsync(item); }