コード例 #1
0
        bool tabPage_ProjectBeforeTabPageCloseEvent(object sender, EventArgs e)
        {
            NDATabPage             tabPage        = (NDATabPage)sender;
            UserControlEditProject projectControl = (UserControlEditProject)tabPage.Controls[0];

            return(projectControl.Close());
        }
コード例 #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;
            }
        }
コード例 #3
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;
                }
            }
        }
コード例 #4
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("提示", "分组已被删除.");
            }
        }