protected void GetEntries() { try { ObservableCollection <Entry> listFileInfo = new ObservableCollection <Entry>(); // Drives if (Path == null || String.IsNullOrEmpty(Path)) { DriveInfo[] drives = DriveInfo.GetDrives(); listFileInfo.Clear(); foreach (DriveInfo drive in drives) { listFileInfo.Add(entryFactory.GetDrive(drive)); } } // Directories and files else { listFileInfo.Clear(); listFileInfo.Add(entryFactory.GetTopLevel(Path)); // ***** string[] directories = Directory.GetDirectories(Path); foreach (var entry in directories) { listFileInfo.Add(entryFactory.GetDirectory(entry)); } // ***** List <string> entries = new List <string>(); //entries.AddRange(Directory.GetDirectories(Path)); entries.AddRange(Directory.GetFiles(Path)); entries.ForEach(entry => listFileInfo.Add(entryFactory.GetFile(entry))); } viewSource.Source = listFileInfo; listViewFile.ItemsSource = viewSource.View; } catch (Exception e) { MessageBox.Show(e.Message); string path = Path; Path = Directory.GetParent(Path)?.FullName; } }