/// <summary> /// Walks the given files recursively to obtain the full tree. /// This triggers List requests against Google Drive. /// </summary> /// <param name="walker"></param> /// <param name="files"></param> /// <returns></returns> private static IFileNode[] Walk(IWalker walker, IFile[] files) { return files.Select(f => walker.ListRecurse(f)).ToArray(); }
public async Task<bool> DeleteDocuments (IFile[] files, UIBarButtonItem deleteButton) { if (DismissSheetsAndPopovers ()) return false; if (files.Length == 0) return false; // // Ask if we should delete // var tcs = new TaskCompletionSource<int> (); ActionSheet = new UIActionSheet (); ActionSheet.AddButton ("Delete " + DescribeFiles (files)); ActionSheet.AddButton ("Cancel"); ActionSheet.DestructiveButtonIndex = 0; ActionSheet.CancelButtonIndex = 1; ActionSheet.Clicked += (ss, se) => { try { tcs.SetResult ((int)se.ButtonIndex); } catch (Exception ex) { Log.Error (ex); } }; ActionSheet.ShowFrom (deleteButton, true); var button = await tcs.Task; if (button != 0) return false; // // Perform the delete // try { await DeleteDocs (files.Select(x => x.Path).ToArray()); foreach (var f in files) { InvalidateThumbnail (f, deleteThumbnail: true, reloadThumbnail: false); } } catch (Exception ex) { Console.WriteLine (ex); } return true; }