async Task Rename(DocumentReference docRef, string newName) { try { var oldIndex = Docs.FindIndex(x => x.File.Path == docRef.File.Path); var r = await docRef.Rename(newName); if (r) { Console.WriteLine("RENAME to {0}: {1}", newName, r); if (oldIndex >= 0) { await LoadDocs(); var newIndex = Docs.FindIndex(x => x.File.Path == docRef.File.Path); if (newIndex >= 0 && newIndex != oldIndex) { docsView.ShowItem(newIndex, true); } } } else { alert = new UIAlertView("Failed to Rename", "You may not have permission.", null, "OK"); alert.Show(); } // AppDelegate.Shared.UpdateDocListName (docIndex); } catch (Exception ex) { Debug.WriteLine(ex); } }