Exemple #1
0
        public Form1()
        {
            InitializeComponent();

            treeView1.BeginUpdate();
            TreeNode  node = new TreeNode();
            NameProxy n    = new NameProxy(File.FileType.Directory);

            n.SetName("root");
            node.Tag  = n;
            node.Text = n.GetName();
            treeView1.Nodes.Add(node);
            treeView1.SelectedNode = node;
            treeView1.EndUpdate();
        }
Exemple #2
0
        private void AddDirectoryButton_Click(object sender, EventArgs e)
        {
            INFO.Text = "";
            treeView1.BeginUpdate();

            TreeNode  node  = new TreeNode();
            NameProxy n     = new NameProxy(File.FileType.Directory);
            bool      state = n.SetName(nodeNameInputBox.Text);

            if (!state)
            {
                INFO.Text = "Incorrect name";
                treeView1.EndUpdate();
                return;
            }
            node.Tag  = n;
            node.Text = n.GetName();
            //Add new node to tree
            treeView1.SelectedNode.Nodes.Add(node);

            treeView1.EndUpdate();
            nodeNameInputBox.Text = "";
        }