示例#1
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (m_TaskInfo == null)
            {
                return;
            }

            U50TaskInfo taskInfo = new U50TaskInfo();

            taskInfo.Guid    = m_TaskInfo.Guid;
            taskInfo.Name    = m_TaskInfo.Name;
            taskInfo.General = m_TaskBControl.GetTaskGeneral();
            taskInfo.Request = m_TaskCControl.GetTaskRequest();
            taskInfo.Policy  = m_TaskDControl.GetTaskPolicy();
            taskInfo.Result  = m_TaskEControl.GetTaskResult();

            U50GlobalSetting.ScanTaskThread(taskInfo);

            this.button3.Enabled = false;
            this.Timer1.Enabled  = true;

            //TaskPolicy taskPolicy = GetTaskPolicy();

            ////ReportInfo reportInfo = ScanTask( taskPolicy );
            //ReportInfo reportInfo = new ReportInfo();

            //for ( int i = 0; i < reportInfo.ReportArray.Length; i++ )
            //{
            //    Report report = reportInfo.ReportArray[i];
            //}
        }
示例#2
0
        public void Initialize()
        {
            U50GlobalSetting.LoadGlobalRegistry();

            if (U50GlobalSetting.IsAutoLoadPolicySetting == true)
            {
                if (U50GlobalSetting.LoadPolicyGlobalSetting() == false)
                {
                    MainForm.ShowPopupMessage("读取策略文件失败!", "可能文件不存在或格式错误。。。", "请点击<配置策略>的<新建策略>");
                }
            }
            m_PolicyForm.Initialize();

            if (U50GlobalSetting.IsAutoLoadTaskSetting == true)
            {
                if (U50GlobalSetting.LoadTaskGlobalSetting() == false)
                {
                    MainForm.ShowPopupMessage("读取任务文件失败!", "可能文件不存在或格式错误。。。", "请点击<配置任务>的<新建任务>");
                }
            }
            m_TaskForm.Initialize();
        }
        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();
        }
        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);


                U50PolicyInfo outPolicyInfo = null;
                if (this.m_TreeNodePolicyInfo.TryGetValue(item, out outPolicyInfo) == true)
                {
                    this.m_TreeNodePolicyInfo.Remove(item);
                    PolicyManager.Instance.RemovePolicyInfoByGuid(outPolicyInfo.Guid);
                }
            }

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

                PolicyCControl configCControl = outConfigControl as PolicyCControl;
                if (configCControl == null)
                {
                    continue;
                }

                item.Value.Policy = configCControl.GetConfigPolicy();

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

                PolicyDControl configDControl = outConfigControl as PolicyDControl;
                if (configDControl == null)
                {
                    continue;
                }

                item.Value.Filtrate = configDControl.GetConfigFiltrate();

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

                PolicyEControl configEControl = outConfigControl as PolicyEControl;
                if (configEControl == null)
                {
                    continue;
                }

                item.Value.Extend = configEControl.GetConfigExtend();

                if (m_NewTreeNode.Contains(item.Key) == true)
                {
                    PolicyManager.Instance.AddStockInfo(item.Value);
                }
            }

            U50GlobalSetting.SavePolicySetting(U50GlobalSetting.PolicyFilePath, PolicyManager.Instance.ToArray());
            U50GlobalSetting.SaveGlobalRegistry();

            m_NewTreeNode.Clear();
            m_DeleteTreeNode.Clear();
        }