public void OpenDirectory(string path) { lvDropboxFiles.Items.Clear(); DropboxDirectoryInfo directory = null; AsyncHelper.AsyncJob(() => { directory = dropbox.GetFilesList(path); }, () => { if (directory != null) { lvDropboxFiles.Tag = directory; ListViewItem lvi = GetParentFolder(directory.Path); if (lvi != null) { lvDropboxFiles.Items.Add(lvi); } foreach (DropboxContentInfo content in directory.Contents.OrderBy(x => !x.Is_dir)) { string filename = Path.GetFileName(content.Path); lvi = new ListViewItem(filename); lvi.SubItems.Add(content.Size); lvi.SubItems.Add(content.Modified); lvi.ImageKey = ilm.AddImage(content.Icon); lvi.Tag = content; lvDropboxFiles.Items.Add(lvi); } CurrentFolderPath = directory.Path.Trim('/'); Text = "Dropbox - " + CurrentFolderPath; } else { MessageBox.Show("Path not exist: " + path, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }); }