private void GetFileStructure() { string myDir = ""; System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog(); fbd.RootFolder = Environment.SpecialFolder.Desktop; fbd.ShowNewFolderButton = false; fbd.Description = "Browse to the root directory where the files are stored."; if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { myDir = fbd.SelectedPath; try { TextRootDir = fbd.SelectedPath; MyFiles.Clear(); foreach (var file in Directory.GetFiles(myDir, TextFilter, SearchOption.AllDirectories)) { MyFiles.Add(file); } } catch (Exception excep) { MessageBox.Show(excep.Message); return; } } }
private void AddToCollection(object passedFile) { if (passedFile == null) { throw new ArgumentNullException(nameof(passedFile)); } if (passedFile is FileViewModel fileViewModel) { MyFiles.Add(fileViewModel); collectionHistory.Collection += MyFiles.Last().FullName; collectionHistory.UpdateCollection(); } }
private void AddFilesToMyFilesList(FileSystemInfo item) { MyFiles.Add(item); }