/// <summary> /// Gets a collection of the files. /// </summary> /// <returns></returns> public override ObservableCollection <FileStructure> GetFiles() { FilesResource.ListRequest listRequest = Service.Files.List(); listRequest.PageSize = 1000; listRequest.Fields = "nextPageToken, files(id, name, fileExtension, size, modifiedByMeTime, parents, trashed, ownedByMe, shared)"; listRequest.PageToken = null; var request = listRequest.Execute(); var files = request.Files; ObservableCollection <Google.Apis.Drive.v3.Data.File> fileList; if (files != null && files.Count > 0) { fileList = new ObservableCollection <Google.Apis.Drive.v3.Data.File>(); foreach (var item in files) { if (item.Parents != null && item.OwnedByMe == true && item.Shared == false) { fileList.Add(item); } } fileList.Add(new Google.Apis.Drive.v3.Data.File { Name = "Trash", Parents = new List <string> { Root }, Trashed = false }); } else { fileList = new ObservableCollection <Google.Apis.Drive.v3.Data.File>(); } return(FileStructure.Convert(fileList, Root)); }
/// <summary> /// Gets file information. /// </summary> /// <returns>A list of files.</returns> public override ObservableCollection <FileStructure> GetFiles() { var task = Task.Run(() => GetFolderFiles()); task.Wait(); var files = task.Result; return(FileStructure.Convert(files)); }