private void LoadBookmarks() { try { Program.Log.Info("Loading users bookmarks"); LabelStatus.Text = "Loading bookmarks..."; BackGroundWorker.RunWorkAsync <List <FtpFile> >(() => Query.Search(Bookmarks.BookmarkedFiles(), TextBoxSearchQuery.Text, SelectedFilesSort, SelectedFilesType, SelectedFilesHost), (List <FtpFile> data) => { if (InvokeRequired) { Invoke(new LoadBookmarksCallBack(LoadBookmarks), new object[] { }); } else { DataGridFiles.Rows.Clear(); ComboBoxHost.Items.Clear(); ComboBoxHost.Items.Add("Any"); foreach (var ftpFile in data) { DataGridFiles.Rows.Add(ftpFile.Name, StringExtensions.BytesToPrefix(ftpFile.Size), StringExtensions.TimeSpanAge(ftpFile.DateModified), new Uri(ftpFile.URL).Host, ftpFile.URL); if (!(ComboBoxHost.Items.Contains(new Uri(ftpFile.URL).Host))) { ComboBoxHost.Items.Add(new Uri(ftpFile.URL).Host); } } LabelStatus.Text = string.Format("{0} Bookmarks", StringExtensions.FormatNumber(DataGridFiles.Rows.Count.ToString())); // Sets selected item to host if (SelectedFilesHost == "") { ComboBoxHost.SelectedIndex = 0; } else { ComboBoxHost.SelectedItem = SelectedFilesHost; } Program.Log.Info("Successfully loaded users bookmarks"); } }); } catch (Exception ex) { Program.Log.Error("Error getting users bookmarks", ex); } }