async void GetProfilePicAsync() { string profilePicPlaceholderPath = "ms-appx:///Assets/StoreLogo.scale-400.png"; ProfilePic = new BitmapImage(new Uri(profilePicPlaceholderPath)); ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings; if (localSettings.Values["PerformerImageFolder"] is string token) { StorageItemAccessList futureAccessList = StorageApplicationPermissions.FutureAccessList; StorageFolder profilePicFolder = await futureAccessList.GetFolderAsync(token); List <string> fileTypeFilter = new List <string> { ".jpg" }; var queryOptions = new QueryOptions(CommonFileQuery.DefaultQuery, fileTypeFilter) { ApplicationSearchFilter = "System.FileName:*\"" + Name + "\"*" }; StorageFileQueryResult queryResult = profilePicFolder.CreateFileQueryWithOptions(queryOptions); var files = await queryResult.GetFilesAsync(); if (files.Count > 0) { BitmapImage screen = new BitmapImage(); screen.SetSource(await files[0].GetThumbnailAsync(ThumbnailMode.SingleItem)); ProfilePic = screen; } } }
private async Task <StorageFolder> DoAThing() { foreach (AccessListEntry entry in Fal.Entries) { return(await Fal.GetFolderAsync(entry.Token)); } return(await PickFolder()); }