Пример #1
0
        private void updateTreeNodes()
        {
            List <int> expanded = ((IdentifiedTreeNode)folderTreeView.Nodes[0]).getExpandedNodes();

            this.folderTreeView.Nodes.Clear();
            this.folderTreeView.Nodes.AddRange(new IdentifiedTreeNode[] { root.createTree() });
            foreach (int i in expanded)
            {
                if (((IdentifiedTreeNode)folderTreeView.Nodes[0]).getNodeWithID(i) != null)
                {
                    ((IdentifiedTreeNode)folderTreeView.Nodes[0]).getNodeWithID(i).Expand();
                }
            }
        }
Пример #2
0
 public FileBrowser(TextEditor subject, Composite root, bool open, bool newFile)
 {
     startNewFile = newFile;
     InitializeComponent();
     this.subject         = subject;
     this.root            = root;
     this.currentPath     = root;
     filePathTextBox.Text = currentPath.getPath();
     fileNameTextBox.Text = subject.currentFile.Name;
     if (open)
     {
         openButton.Visible      = true;
         saveButton.Visible      = false;
         fileNameTextBox.Visible = false;
         newFolderButton.Visible = false;
     }
     else
     {
         openButton.Visible      = false;
         saveButton.Visible      = true;
         fileNameTextBox.Visible = true;
         newFolderButton.Visible = true;
     }
     this.folderTreeView.Nodes.AddRange(new IdentifiedTreeNode[] { root.createTree() });
     updateTreeNodes();
     if (subject.currentFile != subject.untitled)
     {
         List <Composite> lineage = subject.currentFile.getLineage();
         foreach (Composite i in lineage)
         {
             int goalID = i.id;
             ((IdentifiedTreeNode)folderTreeView.Nodes[0]).getNodeWithID(goalID).Expand();
         }
     }
     updateFilePathBox();
 }