private void lbxFolders_Drop(object sender, DragEventArgs e) { string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); if (files != null && files.Count() > 0) { if (_settings.FolderLinks == null) { _settings.FolderLinks = new List <FolderLink>(); } foreach (string s in files) { if (Directory.Exists(s)) { var newFolder = new FolderLink { Path = s }; _settings.FolderLinks.Add(newFolder); } lbxFolders.Items.Refresh(); } } }
private void btnAdd_Click(object sender, RoutedEventArgs e) { var folderBrowserDialog = new FolderBrowserDialog(); if (folderBrowserDialog.ShowDialog() == DialogResult.OK) { var newFolder = new FolderLink { Path = folderBrowserDialog.SelectedPath }; if (_settings.FolderLinks == null) { _settings.FolderLinks = new List <FolderLink>(); } _settings.FolderLinks.Add(newFolder); } lbxFolders.Items.Refresh(); }