private IEnumerable <ActualFile> GetActualFiles(string accessToken) { var task = Task.Run(async() => { using (var dbx = new DropboxClient(accessToken)) { var content = await dbx.Files.ListFolderAsync(new Dropbox.Api.Files.ListFolderArg("/Development")); return(content.Entries.Where(m => m.IsFile && m.IsDeleted == false).Select(m => m.Name).ToArray()); } }); task.Wait(); IEnumerable <ActualFile> result = null; bool succeed = task.Wait(10000); if (succeed && task.IsCompleted) { result = task.Result.Select(r => new ActualFile() { Path = r }); _dbHandler.MergeActualFiles(result); } else { Toast.MakeText(this, "Error: Unable to get task", ToastLength.Short).Show(); } return(result); }