private void NewTask(U50TaskInfo taskInfo)
        {
            m_TaskName.Add(taskInfo.Name);

            // U50策略01
            TreeNode newTreeNodeTask     = new TreeNode(string.Format("U50任务{0}", m_TaskCount++));
            TreeNode newTreeNodeTaskSub  = new TreeNode("常规");
            TreeNode newTreeNodeTaskSub1 = new TreeNode("需求");
            TreeNode newTreeNodeTaskSub2 = new TreeNode("策略");
            TreeNode newTreeNodeTaskSub3 = new TreeNode("扫描结果");

            newTreeNodeTask.Nodes.Add(newTreeNodeTaskSub);
            newTreeNodeTask.Nodes.Add(newTreeNodeTaskSub1);
            newTreeNodeTask.Nodes.Add(newTreeNodeTaskSub2);
            newTreeNodeTask.Nodes.Add(newTreeNodeTaskSub3);


            TaskBControl taskBControl = new TaskBControl();

            taskBControl.Dock    = DockStyle.Fill;
            taskBControl.Visible = false;
            taskBControl.SetConfigPolicy(taskInfo.General);

            this.m_AllConfigControlInfo.Add(newTreeNodeTask, taskBControl);
            this.m_AllConfigControlInfo.Add(newTreeNodeTaskSub, taskBControl);

            this.Panel.Controls.Add(taskBControl);

            TaskCControl taskCControl = new TaskCControl();

            taskCControl.Dock    = DockStyle.Fill;
            taskCControl.Visible = false;
            taskCControl.SetConfigPolicy(taskInfo.Request);

            this.m_AllConfigControlInfo.Add(newTreeNodeTaskSub1, taskCControl);

            this.Panel.Controls.Add(taskCControl);

            TaskDControl taskDControl = new TaskDControl();

            taskDControl.Dock    = DockStyle.Fill;
            taskDControl.Visible = false;
            taskDControl.SetConfigPolicy(taskInfo.Policy);

            this.m_AllConfigControlInfo.Add(newTreeNodeTaskSub2, taskDControl);

            this.Panel.Controls.Add(taskDControl);

            TaskEControl taskEControl = new TaskEControl();

            taskEControl.Dock    = DockStyle.Fill;
            taskEControl.Visible = false;
            taskEControl.SetConfigPolicy(taskInfo.Result);

            this.m_AllConfigControlInfo.Add(newTreeNodeTaskSub3, taskEControl);

            this.Panel.Controls.Add(taskEControl);

            //
            taskDControl.m_TaskInfo     = taskInfo;
            taskDControl.m_TaskBControl = taskBControl;
            taskDControl.m_TaskCControl = taskCControl;
            taskDControl.m_TaskDControl = taskDControl;
            taskDControl.m_TaskEControl = taskEControl;

            this.TreeView.Nodes.Add(newTreeNodeTask);

            this.TreeView.SelectedNode = newTreeNodeTask;

            m_TreeNodeTaskInfo.Add(newTreeNodeTask, taskInfo);
        }
        private void ButtonOK_Click(object sender, EventArgs e)
        {
            foreach (var item in m_DeleteTreeNode)
            {
                UserControl outConfigControl = null;
                if (this.m_AllConfigControlInfo.TryGetValue(item.Nodes[0], out outConfigControl) == true)
                {
                    if (outConfigControl == m_CurrentConfigControl)
                    {
                        this.TreeView.SelectedNode = m_MainTreeNodeSub;
                    }

                    this.Panel.Controls.Remove(outConfigControl);
                }

                if (this.m_AllConfigControlInfo.TryGetValue(item.Nodes[1], out outConfigControl) == true)
                {
                    if (outConfigControl == m_CurrentConfigControl)
                    {
                        this.TreeView.SelectedNode = m_MainTreeNodeSub;
                    }

                    this.Panel.Controls.Remove(outConfigControl);
                }

                if (this.m_AllConfigControlInfo.TryGetValue(item.Nodes[2], out outConfigControl) == true)
                {
                    if (outConfigControl == m_CurrentConfigControl)
                    {
                        this.TreeView.SelectedNode = m_MainTreeNodeSub;
                    }

                    this.Panel.Controls.Remove(outConfigControl);
                }

                if (this.m_AllConfigControlInfo.TryGetValue(item.Nodes[3], out outConfigControl) == true)
                {
                    if (outConfigControl == m_CurrentConfigControl)
                    {
                        this.TreeView.SelectedNode = m_MainTreeNodeSub;
                    }

                    this.Panel.Controls.Remove(outConfigControl);
                }

                this.m_AllConfigControlInfo.Remove(item.Nodes[0]);
                this.m_AllConfigControlInfo.Remove(item.Nodes[1]);
                this.m_AllConfigControlInfo.Remove(item.Nodes[2]);
                this.m_AllConfigControlInfo.Remove(item.Nodes[3]);
                this.m_AllConfigControlInfo.Remove(item);

                U50TaskInfo outTaskInfo = null;
                if (this.m_TreeNodeTaskInfo.TryGetValue(item, out outTaskInfo) == true)
                {
                    this.m_TreeNodeTaskInfo.Remove(item);
                    TaskManager.Instance.RemoveTaskInfoByGuid(outTaskInfo.Guid);
                }
            }

            foreach (var item in m_TreeNodeTaskInfo)
            {
                UserControl outTaskControl = null;
                if (m_AllConfigControlInfo.TryGetValue(item.Key.Nodes[0], out outTaskControl) == false)
                {
                    continue;
                }

                TaskBControl taskBControl = outTaskControl as TaskBControl;
                if (taskBControl == null)
                {
                    continue;
                }

                item.Value.General = taskBControl.GetTaskGeneral();

                if (m_AllConfigControlInfo.TryGetValue(item.Key.Nodes[1], out outTaskControl) == false)
                {
                    continue;
                }

                TaskCControl taskCControl = outTaskControl as TaskCControl;
                if (taskCControl == null)
                {
                    continue;
                }

                item.Value.Request = taskCControl.GetTaskRequest();

                if (m_AllConfigControlInfo.TryGetValue(item.Key.Nodes[2], out outTaskControl) == false)
                {
                    continue;
                }

                TaskDControl taskDControl = outTaskControl as TaskDControl;
                if (taskDControl == null)
                {
                    continue;
                }

                item.Value.Policy = taskDControl.GetTaskPolicy();

                if (m_AllConfigControlInfo.TryGetValue(item.Key.Nodes[3], out outTaskControl) == false)
                {
                    continue;
                }

                TaskEControl taskEControl = outTaskControl as TaskEControl;
                if (taskDControl == null)
                {
                    continue;
                }

                item.Value.Result = taskEControl.GetTaskResult();

                if (m_NewTreeNode.Contains(item.Key) == true)
                {
                    TaskManager.Instance.AddTaskInfo(item.Value);
                }
            }

            U50GlobalSetting.SaveTaskSetting(U50GlobalSetting.TaskFilePath, TaskManager.Instance.ToArray());
            U50GlobalSetting.SaveGlobalRegistry();

            m_NewTreeNode.Clear();
            m_DeleteTreeNode.Clear();
        }
        public void NewTask()
        {
            if (m_IsInitializing == false)
            {
                TaskForm_Load(this, EventArgs.Empty);
            }

            U50TaskInfo taskInfo = new U50TaskInfo();

            taskInfo.Guid = Guid.NewGuid().ToString();

            do
            {
                taskInfo.Name = string.Format("U50任务{0}", m_TaskCount++);

                if (m_TaskName.Contains(taskInfo.Name) == false)
                {
                    break;
                }
            } while (true);

            // U50策略01
            TreeNode newTreeNodeTask     = new TreeNode(taskInfo.Name);
            TreeNode newTreeNodeTaskSub  = new TreeNode("常规");
            TreeNode newTreeNodeTaskSub1 = new TreeNode("需求");
            TreeNode newTreeNodeTaskSub2 = new TreeNode("策略");
            TreeNode newTreeNodeTaskSub3 = new TreeNode("扫描结果");

            newTreeNodeTask.Nodes.Add(newTreeNodeTaskSub);
            newTreeNodeTask.Nodes.Add(newTreeNodeTaskSub1);
            newTreeNodeTask.Nodes.Add(newTreeNodeTaskSub2);
            newTreeNodeTask.Nodes.Add(newTreeNodeTaskSub3);

            TaskBControl taskBControl = new TaskBControl();

            taskBControl.Dock    = DockStyle.Fill;
            taskBControl.Visible = false;
            taskInfo.General     = taskBControl.GetTaskGeneral();

            this.m_AllConfigControlInfo.Add(newTreeNodeTask, taskBControl);
            this.m_AllConfigControlInfo.Add(newTreeNodeTaskSub, taskBControl);

            this.Panel.Controls.Add(taskBControl);

            TaskCControl taskCControl = new TaskCControl();

            taskCControl.Dock    = DockStyle.Fill;
            taskCControl.Visible = false;
            taskInfo.Request     = taskCControl.GetTaskRequest();

            this.m_AllConfigControlInfo.Add(newTreeNodeTaskSub1, taskCControl);

            this.Panel.Controls.Add(taskCControl);

            TaskDControl taskDControl = new TaskDControl();

            taskDControl.Dock    = DockStyle.Fill;
            taskDControl.Visible = false;
            taskInfo.Policy      = taskDControl.GetTaskPolicy();

            this.m_AllConfigControlInfo.Add(newTreeNodeTaskSub2, taskDControl);

            this.Panel.Controls.Add(taskDControl);

            TaskEControl taskEControl = new TaskEControl();

            taskEControl.Dock    = DockStyle.Fill;
            taskEControl.Visible = false;
            taskInfo.Result      = taskEControl.GetTaskResult();

            this.m_AllConfigControlInfo.Add(newTreeNodeTaskSub3, taskEControl);

            this.Panel.Controls.Add(taskEControl);

            //
            taskDControl.m_TaskInfo     = taskInfo;
            taskDControl.m_TaskBControl = taskBControl;
            taskDControl.m_TaskCControl = taskCControl;
            taskDControl.m_TaskDControl = taskDControl;
            taskDControl.m_TaskEControl = taskEControl;

            this.TreeView.Nodes.Add(newTreeNodeTask);

            this.TreeView.SelectedNode = newTreeNodeTask;

            m_NewTreeNode.Add(newTreeNodeTask);

            m_TreeNodeTaskInfo.Add(newTreeNodeTask, taskInfo);
        }