Exemplo n.º 1
0
        bool tabPage_RunBeforeTabPageCloseEvent(object sender, EventArgs e)
        {
            NDATabPage tabPage = (NDATabPage)sender;
            UserControlRunGrabWebPage runControl = (UserControlRunGrabWebPage)tabPage.Controls[0];

            return(runControl.Close());
        }
Exemplo n.º 2
0
        private void toolStripMenuItemAddProject_Click(object sender, EventArgs e)
        {
            TreeNode selectedNode = this.treeViewProjectList.SelectedNode;

            if (selectedNode == null)
            {
                CommonUtil.Alert("提示", "请选择或新建分组.");
            }
            else
            {
                TreeNode   groupNode = ((selectedNode.Tag is Proj_Main) ? selectedNode.Parent : selectedNode);
                Proj_Group group     = (Proj_Group)groupNode.Tag;

                string     id      = group.Id + "_New_Project";
                NDATabPage tabPage = CheckExistTabPage(id);
                if (tabPage == null)
                {
                    UserControlEditProject projectControl = new UserControlEditProject(group.Id, null);
                    projectControl.AfterSaveEvent += new AfterSaveHandler(projectControl_AfterSaveEvent);
                    projectControl.Dock            = DockStyle.Fill;
                    tabPage = this.CreateTabPage(id, "新建项目");
                    tabPage.Controls.Add(projectControl);
                    tabPage.BeforeTabPageCloseEvent += new BeforeTabPageCloseHandler(tabPage_ProjectBeforeTabPageCloseEvent);
                }
                this.tabControlMain.SelectedTab = tabPage;
            }
        }
Exemplo n.º 3
0
 private void CloseTabPage(NDATabPage tabPage)
 {
     if (tabPage.BeforeClose())
     {
         this.tabControlMain.TabPages.Remove(tabPage);
     }
 }
Exemplo n.º 4
0
        bool tabPage_ProjectBeforeTabPageCloseEvent(object sender, EventArgs e)
        {
            NDATabPage             tabPage        = (NDATabPage)sender;
            UserControlEditProject projectControl = (UserControlEditProject)tabPage.Controls[0];

            return(projectControl.Close());
        }
Exemplo n.º 5
0
        bool tabPage_GroupBeforeTabPageCloseEvent(object sender, EventArgs e)
        {
            NDATabPage           tabPage      = (NDATabPage)sender;
            UserControlEditGroup groupControl = (UserControlEditGroup)tabPage.Controls[0];

            return(groupControl.Close());
        }
Exemplo n.º 6
0
 void tabControlMain_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (this.tabControlMain.SelectedTab is NDATabPage)
     {
         NDATabPage tabPage = (NDATabPage)this.tabControlMain.SelectedTab;
         CloseTabPage(tabPage);
     }
 }
Exemplo n.º 7
0
        private NDATabPage CreateTabPage(string id, string text)
        {
            NDATabPage newTabPage = new NDATabPage();

            newTabPage.Id   = id;
            newTabPage.Text = text;
            this.tabControlMain.TabPages.Add(newTabPage);
            return(newTabPage);
        }
Exemplo n.º 8
0
        void groupControl_AfterSaveEvent(object sender, EventArgs e)
        {
            UserControlEditGroup groupControl = (UserControlEditGroup)sender;
            TreeNode             groupNode    = ShowGroup(groupControl.Group, true);

            RefreshGroupNodeText(groupNode);
            this.treeViewProjectList.SelectedNode = groupNode;
            NDATabPage tabPage = (NDATabPage)groupControl.Parent;

            tabPage.Id   = groupControl.Group.Id;
            tabPage.Text = "分组:" + groupControl.Group.Name;
        }
Exemplo n.º 9
0
 private void CloseTaskUI(string taskId)
 {
     foreach (TabPage tabPage in this.tabControlMain.TabPages)
     {
         if (tabPage is NDATabPage)
         {
             NDATabPage ndaTabPage = (NDATabPage)tabPage;
             if (ndaTabPage.Id == taskId)
             {
                 CloseTabPage(ndaTabPage);
                 break;
             }
         }
     }
 }
Exemplo n.º 10
0
 private NDATabPage CheckExistTabPage(string id)
 {
     foreach (TabPage tp in this.tabControlMain.TabPages)
     {
         if (tp is NDATabPage)
         {
             NDATabPage tabPage = (NDATabPage)tp;
             if (tabPage.Id == id)
             {
                 return(tabPage);
             }
         }
     }
     return(null);
 }
Exemplo n.º 11
0
        private void toolStripMenuItemAddGroup_Click(object sender, EventArgs e)
        {
            string     id      = "New_Group";
            NDATabPage tabPage = CheckExistTabPage(id);

            if (tabPage == null)
            {
                UserControlEditGroup groupControl = new UserControlEditGroup(null);
                groupControl.AfterSaveEvent += new AfterSaveHandler(groupControl_AfterSaveEvent);
                groupControl.Dock            = DockStyle.Fill;
                tabPage = this.CreateTabPage(id, "新建分组");
                tabPage.Controls.Add(groupControl);
                tabPage.BeforeTabPageCloseEvent += new BeforeTabPageCloseHandler(tabPage_GroupBeforeTabPageCloseEvent);
            }
            this.tabControlMain.SelectedTab = tabPage;
        }
Exemplo n.º 12
0
        private void EditNodeObject(TreeNode selectedNode)
        {
            if (selectedNode == null)
            {
                CommonUtil.Alert("提示", "无选中项");
            }
            else
            {
                if (selectedNode.Tag is Proj_Group)
                {
                    Proj_Group group = (Proj_Group)selectedNode.Tag;

                    string     id      = group.Id;
                    NDATabPage tabPage = CheckExistTabPage(id);
                    if (tabPage == null)
                    {
                        UserControlEditGroup groupControl = new UserControlEditGroup(group);
                        groupControl.AfterSaveEvent += new AfterSaveHandler(groupControl_AfterSaveEvent);
                        groupControl.Dock            = DockStyle.Fill;
                        tabPage = this.CreateTabPage(id, "分组:" + group.Name);
                        tabPage.Controls.Add(groupControl);
                        tabPage.BeforeTabPageCloseEvent += new BeforeTabPageCloseHandler(tabPage_GroupBeforeTabPageCloseEvent);
                    }
                    this.tabControlMain.SelectedTab = tabPage;
                }
                else if (selectedNode.Tag is Proj_Main)
                {
                    Proj_Main  project = (Proj_Main)selectedNode.Tag;
                    Proj_Group group   = (Proj_Group)selectedNode.Parent.Tag;

                    string     id      = project.Id;
                    NDATabPage tabPage = CheckExistTabPage(id);
                    if (tabPage == null)
                    {
                        UserControlEditProject projectControl = new UserControlEditProject(group.Id, project);
                        projectControl.AfterSaveEvent += new AfterSaveHandler(projectControl_AfterSaveEvent);
                        projectControl.Dock            = DockStyle.Fill;
                        tabPage = this.CreateTabPage(id, "项目:" + project.Name);
                        tabPage.Controls.Add(projectControl);
                        tabPage.BeforeTabPageCloseEvent += new BeforeTabPageCloseHandler(tabPage_ProjectBeforeTabPageCloseEvent);
                    }
                    this.tabControlMain.SelectedTab = tabPage;
                }
            }
        }
Exemplo n.º 13
0
        private void toolStripButtonRun_Click(object sender, EventArgs e)
        {
            TreeNode selectedNode = this.treeViewProjectList.SelectedNode;

            if (selectedNode.Tag is Proj_Main)
            {
                Proj_Main  project = (Proj_Main)selectedNode.Tag;
                string     tabId   = "Run_" + project.Id;
                NDATabPage tabPage = CheckExistTabPage(tabId);
                if (tabPage == null)
                {
                    UserControlRunGrabWebPage runControl = new UserControlRunGrabWebPage(project);
                    runControl.Dock = DockStyle.Fill;
                    tabPage         = this.CreateTabPage(tabId, "执行:" + project.Name);
                    tabPage.Controls.Add(runControl);
                    tabPage.BeforeTabPageCloseEvent += new BeforeTabPageCloseHandler(tabPage_RunBeforeTabPageCloseEvent);
                }
                this.tabControlMain.SelectedTab = tabPage;
            }
        }
Exemplo n.º 14
0
        private void RunTask(string groupName, string projectName, string listFilePath, string inputDir, string middleDir, string outputDir, string parameters, string stepId, bool autoRun, bool popPrompt)
        {
            Proj_Main project = GetProject(groupName, projectName);

            if (project != null)
            {
                string     tabId   = autoRun ? stepId : projectName;
                NDATabPage tabPage = CheckExistTabPage(tabId);
                UserControlRunGrabWebPage runControl = new UserControlRunGrabWebPage(project, autoRun, popPrompt, listFilePath, inputDir, middleDir, outputDir, parameters, stepId);
                runControl.Dock = DockStyle.Fill;
                tabPage         = this.CreateTabPage(tabId, "执行Task step:" + projectName + "(stepId=" + stepId + ")");
                tabPage.Controls.Add(runControl);
                tabPage.BeforeTabPageCloseEvent += new BeforeTabPageCloseHandler(tabPage_RunBeforeTabPageCloseEvent);
                this.tabControlMain.SelectedTab  = tabPage;
            }
            else
            {
                throw new Exception("不存在的项目, groupName = " + groupName + ", projectName = " + projectName + ".");
            }
        }
Exemplo n.º 15
0
        void projectControl_AfterSaveEvent(object sender, EventArgs e)
        {
            UserControlEditProject projectControl = (UserControlEditProject)sender;
            TreeNode groupNode = GetGroupNode(projectControl.GroupId);

            if (groupNode != null)
            {
                TreeNode projectNode = ShowProject(groupNode, projectControl.Project, true);
                RefreshGroupNodeText(groupNode);
                groupNode.Expand();
                this.treeViewProjectList.SelectedNode = projectNode;
                NDATabPage tabPage = (NDATabPage)projectControl.Parent;
                tabPage.Id   = projectControl.Project.Id;
                tabPage.Text = "项目:" + projectControl.Project.Name;
            }
            else
            {
                CommonUtil.Alert("提示", "分组已被删除.");
            }
        }