// Get all the images from the Dropbox folder void GetImages(object sender, RestClientMetadataLoadedEventArgs e) { // If the path is a file, there is nothing to search if (!e.Metadata.IsDirectory) { new UIAlertView("Not a directory", "The specified path is a file, not a directory", null, "OK", null).Show(); return; } Root.Add(new Section("Upload a file to Dropbox") { new StringElement("Write a new file", () => NavigationController.PushViewController(new TextViewController(), true)) }); // Section that will contain the name of the images var imagesName = new Section("Images from Dropbox"); // Will get only the images with .jpg or .jpeg extension foreach (var item in e.Metadata.Contents) { if (!item.IsDirectory && (item.Path.EndsWith(".jpeg", StringComparison.InvariantCultureIgnoreCase) || item.Path.EndsWith(".jpg", StringComparison.InvariantCultureIgnoreCase))) { imagesName.Add(new StringElement(item.Filename, () => NavigationController.PushViewController(new ImageViewController(item.Path, item.Filename), true))); } } if (imagesName.Count == 0) { new UIAlertView("No images found", "Please add some images to the Dropbox Folder", null, "OK", null).Show(); } else { Root.Add(imagesName); } }
// Get all the images from the Dropbox folder void GetImages (object sender, RestClientMetadataLoadedEventArgs e) { // If the path is a file, there is nothing to search if (!e.Metadata.IsDirectory) { new UIAlertView ("Not a directory", "The specified path is a file, not a directory", null, "OK", null).Show (); return; } Root.Add (new Section ("Upload a file to Dropbox") { new StringElement ("Write a new file", () => NavigationController.PushViewController (new TextViewController (), true)) }); // Section that will contain the name of the images var imagesName = new Section ("Images from Dropbox"); // Will get only the images with .jpg or .jpeg extension foreach (var item in e.Metadata.Contents) { if (!item.IsDirectory && (item.Path.EndsWith (".jpeg", StringComparison.InvariantCultureIgnoreCase) || item.Path.EndsWith (".jpg", StringComparison.InvariantCultureIgnoreCase))) imagesName.Add (new StringElement (item.Filename, () => NavigationController.PushViewController (new ImageViewController (item.Path, item.Filename), true))); } if (imagesName.Count == 0) new UIAlertView ("No images found", "Please add some images to the Dropbox Folder", null, "OK", null).Show (); else Root.Add (imagesName); }