Beispiel #1
0
        FileInfo[] Duyetfile(String a)
        {
            NewProject    newproject    = new NewProject();
            string        directoryPath = newproject.txtName.Text;
            string        pathabc       = @"D:\Automation Test\" + _treeViewProjectExplore.Nodes[0].Text + @"\Data";
            DirectoryInfo dirinfo       = new DirectoryInfo(pathabc);

            FileInfo[] fileinfolist = dirinfo.GetFiles();
            return(fileinfolist);
        }
Beispiel #2
0
        private void projectToolStripNewProject_Click(object sender, EventArgs e)
        {
            Text = "";
            _treeViewProjectExplore.Nodes.Clear();
            tabControl1.TabPages.Clear();
            NewProject newpj = new NewProject();
            newpj.ShowDialog();
            if (newpj.DialogResult == System.Windows.Forms.DialogResult.Yes)
            {
                string path = newpj.ProjectPath;
                // lấy path ra ở đây...
                TreeNode treenode;

                DirectoryInfo dir = new DirectoryInfo(path);
                if (dir.Exists)
                {
                    treenode = new TreeNode(dir.Name);
                    treenode.Tag = dir;
                    treenode.Name = "Folder";
                    treenode.ImageIndex = 0;
                    treenode.SelectedImageIndex = 0;
                    // GetDirectories(dir.GetDirectories(), treenode);
                    _treeViewProjectExplore.Nodes.Add(treenode);

                    try
                    {
                        DirectoryInfo[] directories = dir.GetDirectories();
                        if (directories.Length > 0)
                        {
                            foreach (DirectoryInfo directory in directories)
                            {
                                TreeNode node = treenode.Nodes.Add(directory.Name);
                                node.Tag = directory.Name;
                                node.ImageIndex = node.SelectedImageIndex = 0;
                                foreach (FileInfo file in directory.GetFiles())
                                {
                                    treenode = new TreeNode(file.Name);
                                    treenode.Tag = file;
                                    treenode.Name = "File";
                                     treenode.ImageIndex = 0;
                                    treenode.SelectedImageIndex = 0; ;
                                    _treeViewProjectExplore.Nodes.Add(treenode);

                                    if (file.Exists)
                                    {
                                        TreeNode nodes = _treeViewProjectExplore.Nodes[0].Nodes[node.Index].Nodes.Add(file.Name);
                                        treenode.ImageIndex = 0; ;
                                    }
                                }
                            }
                            _treeViewProjectExplore.ExpandAll();
                        }

                    }
                    catch (Exception ex)
                    {
                        System.Windows.Forms.MessageBox.Show(ex.Message);

                    }
                    Text = _treeViewProjectExplore.Nodes[0].Text + " - " + "Automation Test With Selenium";
                }
            }
        }
Beispiel #3
0
 FileInfo[] Duyetfile(String a)
 {
     NewProject newproject = new NewProject();
     string directoryPath = newproject.txtName.Text;
     string pathabc = @"D:\Automation Test\" + _treeViewProjectExplore.Nodes[0].Text + @"\Data";
     DirectoryInfo dirinfo = new DirectoryInfo(pathabc);
     FileInfo[] fileinfolist = dirinfo.GetFiles();
     return fileinfolist;
 }
Beispiel #4
0
        //new project phim tat
        private void newToolStripButton_Click(object sender, EventArgs e)
        {
            Text = "";
            _treeViewProjectExplore.Nodes.Clear();
            tabControl1.TabPages.Clear();
            NewProject newpj = new NewProject();

            newpj.ShowDialog();
            if (newpj.DialogResult == System.Windows.Forms.DialogResult.Yes)
            {
                string path = newpj.ProjectPath;
                // lấy path ra ở đây...
                TreeNode treenode;

                DirectoryInfo dir = new DirectoryInfo(path);
                if (dir.Exists)
                {
                    treenode                    = new TreeNode(dir.Name);
                    treenode.Tag                = dir;
                    treenode.Name               = "Folder";
                    treenode.ImageIndex         = 0;
                    treenode.SelectedImageIndex = 0;
                    // GetDirectories(dir.GetDirectories(), treenode);
                    _treeViewProjectExplore.Nodes.Add(treenode);

                    try
                    {
                        DirectoryInfo[] directories = dir.GetDirectories();
                        if (directories.Length > 0)
                        {
                            foreach (DirectoryInfo directory in directories)
                            {
                                TreeNode node = treenode.Nodes.Add(directory.Name);
                                node.Tag        = directory.Name;
                                node.ImageIndex = node.SelectedImageIndex = 0;
                                foreach (FileInfo file in directory.GetFiles())
                                {
                                    treenode                    = new TreeNode(file.Name);
                                    treenode.Tag                = file;
                                    treenode.Name               = "File";
                                    treenode.ImageIndex         = treenode.SelectedImageIndex = 0;;
                                    treenode.SelectedImageIndex = 0;
                                    _treeViewProjectExplore.Nodes.Add(treenode);

                                    if (file.Exists)
                                    {
                                        TreeNode nodes = _treeViewProjectExplore.Nodes[0].Nodes[node.Index].Nodes.Add(file.Name);
                                        treenode.ImageIndex = 0;
                                        node.ImageIndex     = node.SelectedImageIndex = 0;
                                    }
                                }
                            }
                            _treeViewProjectExplore.ExpandAll();
                        }
                    }
                    catch (Exception ex)
                    {
                        System.Windows.Forms.MessageBox.Show(ex.Message);
                    }
                    Text = _treeViewProjectExplore.Nodes[0].Text + " - " + "Automation Test With Selenium";
                }
            }
        }