private TreeNode CreateDirectoryNode(DirectoryInfo directoryInfo) { var directoryNode = new TreeNode(directoryInfo.Name, directoryInfo.FullName); foreach (var directory in directoryInfo.GetDirectories()) directoryNode.Items.Add(CreateDirectoryNode(directory)); return directoryNode; }
//*******************************************************// // METHODS // //*******************************************************// public TRVDirectoriesViewModel() { _Root = new TreeNode() { Title = "Root" }; }
//*******************************************************// // METHODS // //*******************************************************// public void ChangeDirectory(TreeNode directory) { if (_FilesList == null) _FilesList = new ObservableCollection<FileModel>(); _FilesList.Clear(); if (directory != null) { if (Directory.Exists(directory.Path)) { var directoryInfo = new DirectoryInfo(directory.Path); foreach (var file in directoryInfo.GetFiles()) _FilesList.Add(new FileModel(file.FullName)); } } OnPropertyChanged("FilesList"); }