public async Task <string> PickImageAsync(string source) { var picker = new FileOpenPicker { ViewMode = PickerViewMode.Thumbnail, SuggestedStartLocation = PickerLocationId.PicturesLibrary }; picker.FileTypeFilter.Add(".jpg"); picker.FileTypeFilter.Add(".jpeg"); picker.FileTypeFilter.Add(".png"); StorageFile result = await picker.PickSingleFileAsync(); if (result != null && !string.IsNullOrEmpty(result.Path)) { if (!string.IsNullOrEmpty(source)) { WinIsolatedStorage.DeleteAsync(source); } string filename = "background-" + Guid.NewGuid() + Path.GetExtension(result.Path); StorageFile file = await ApplicationData.Current.LocalFolder.CreateFileAsync(filename, CreationCollisionOption.ReplaceExisting); await result.CopyAndReplaceAsync(file); return(filename); } return(null); }
public async Task SaveFileAsync <T>(T item, string filename) { await WinIsolatedStorage.SaveAsync(item, filename); }
public async Task <T> LoadFileAsync <T>(string filename) { return(await WinIsolatedStorage.RestoreAsync <T>(filename)); }
public async Task DeleteFileAsync(string path) { await WinIsolatedStorage.DeleteAsync(path); }