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