Ejemplo n.º 1
0
        private void repositoryFolderExpand(object sender)
        {
            TreeNode node = sender as TreeNode;

            if (node.Tag is RepositoryExplorer.FolderInfo)
            {
                RepositoryExplorer.FolderInfo folderInfo = (RepositoryExplorer.FolderInfo)node.Tag;

                if (!folderInfo.Loaded)
                {
                    LoadRepositoryFolder(node);
                }
            }
        }
Ejemplo n.º 2
0
        private void LoadRepositoryFolder(TreeNode parent)
        {
            m_repositoryExplorer.Tree.BeginUpdate();

            RepositoryExplorer.FolderInfo folderInfo = (RepositoryExplorer.FolderInfo)parent.Tag;

            string path = (folderInfo).FolderName;

            parent.Nodes.Clear();

            Dictionary <string, bool> isExpanded = new Dictionary <string, bool>();

            foreach (TreeNode n in parent.Nodes)
            {
                isExpanded.Add(n.Name, n.IsExpanded);
            }

            parent.Nodes.Clear();

            // retrieve server projects
            //string[] projectNames = m_WebService.GetRepositoryProjectNames(path);
            string[] projectNames = m_WebService.Get <String[]>("repository/projects?path=" + path);

            foreach (string projectName in projectNames)
            {
                string pathName = folderInfo.FolderName + projectName;

                Project project = GetProjectObject(pathName).BaseProject;

                TreeNode node = parent.Nodes.Add(projectName, projectName);
                node.Tag = pathName;

                node.ImageIndex         = 3;
                node.SelectedImageIndex = 3;

                Dictionary <string, Process> processes = new Dictionary <string, Process>();
                foreach (Process process in project.ProcessList)
                {
                    processes.Add(process.Name, process);
                }
                foreach (string name in processes.Keys)
                {
                    TreeNode treeNodeProcess = node.Nodes.Add(name, name);
                    treeNodeProcess.Tag = processes[name];

                    if (project.StartUpProcess == name)
                    {
                        treeNodeProcess.ImageIndex         = 7;
                        treeNodeProcess.SelectedImageIndex = 7;
                    }
                    else
                    {
                        treeNodeProcess.ImageIndex         = 5;
                        treeNodeProcess.SelectedImageIndex = 5;
                    }
                }

                if (isExpanded.ContainsKey(node.Name) && isExpanded[node.Name])
                {
                    node.Expand();
                }
            }

            //string[] folderNames = m_WebService.GetRepositoryFolderNames(path);
            string[] folderNames = m_WebService.Get <String[]>("repository/folders?path=" + path);

            foreach (string pathname in folderNames)
            {
                string folder = pathname;

                TreeNode node = parent.Nodes.Add(folder, folder);
                node.Tag = new RepositoryExplorer.FolderInfo()
                {
                    FolderName = folderInfo.FolderName + folder + '.', Loaded = false
                };

                node.ImageIndex         = 2;
                node.SelectedImageIndex = 2;

                node.Nodes.Add("");
            }

            m_repositoryExplorer.Tree.Sort();

            folderInfo.Loaded = true;

            m_repositoryExplorer.Tree.EndUpdate();
        }