private void GetSubFolders(bool value) { if (value && SubFolders.Any(o => string.IsNullOrEmpty(o.FolderName))) { SubFolders.Clear(); var subfolders = Directory.GetDirectories(Path); foreach (var item in subfolders) { try { SubFolders.Add(new FolderViewModel(item, this)); } catch (Exception e) { } } } }
public void LoadSubFolders(bool loadChild) { SubFolders.Clear(); try { foreach (var subFolderPath in _model.GetSubDirectories()) { var subFolder = new FolderViewModel(subFolderPath); if (loadChild) { subFolder.LoadSubFolders(false); } SubFolders.Add(subFolder); } } catch (Exception ex) { } }
private void LoadSubFolders(DirectoryInfo dir) { SubFolders.Clear(); var securityTmp = dir.GetAccessControl(); if (!securityTmp.AreAccessRulesProtected || !securityTmp.AreAuditRulesProtected) { var subDirs = dir.GetDirectories(); if (subDirs.Length > 0) { for (int i = 0; i < subDirs.Length; i++) { if ((subDirs[i].Attributes & FileAttributes.Hidden) != FileAttributes.Hidden) { FolderElement tmpFolder = new FolderElement(new DirectoryInfo(subDirs[i].FullName)); tmpFolder.Parent = this; SubFolders.Add(tmpFolder); } } } } }