Ejemplo n.º 1
0
        public void SelectTreeItem(string path)
        {
            if (!Directory.Exists(path))
            {
                logger.Log(LogFactory.CreateWarningMessage($"Path '{path}' does not exist."));
                return;
            }

            if (CurrentNode != null &&
                CurrentNode.Path.Equals(path, StringComparison.OrdinalIgnoreCase))
            {
                return;
            }

            List <string> list = CreatePaths(path);

            foreach (string item in list)
            {
                if (nodeDict.ContainsKey(item))
                {
                    ITreeItem node = nodeDict[item];
                    if (!node.IsExpanded)
                    {
                        node.IsExpanded = true;
                    }
                }
            }

            if (nodeDict.ContainsKey(path.ToLower()))
            {
                nodeDict[path.ToLower()].IsSelected = true;
            }
        }
Ejemplo n.º 2
0
 public void ChangePath(string directoryPath)
 {
     RemoveAll();
     ActionResult<IEnumerable<DirectoryInfo>> actionResult = DirectoryCrawler.GetSubFolders(directoryPath, false);
     if (actionResult.Successful)
     {
         foreach (DirectoryInfo item in actionResult.Result)
         {
             FolderListItemViewModel vm = new FolderListItemViewModel(item);
             AddItem(vm);
         }
     }
     else
     {
         logger.Log(LogFactory.CreateWarningMessage(actionResult.GetComments()));
     }
 }