//显示任务运行信息 private void livTaskView_OnShowTaskRuntimeInfo(object sender, EventArgs e) { //便利选定的任务项 foreach (ListViewItem item in this.livTaskView.SelectedItems) { //与任务集合项进行匹配 foreach (Config.TaskUnit unit in this.livTaskView._TaskItem) { //判断名称是否一致 if (item.Text.Equals(unit.TaskConfig.Name)) { bool isShow = true; foreach (TabPage page in this.tabContent.TabPages) { if (page.Text.Equals(unit.TaskConfig.Name)) { isShow = false; break; } } //创建一个选项卡 if (isShow) { Utility.TaskResultLog fromLogPanel = new Utility.TaskResultLog(unit.TaskConfig.Name, unit.TaskConfig.ExtractionRules); this.tabContent.TabPages.Add(fromLogPanel); this.tabContent.SelectedTab = fromLogPanel; } break; } } } }
//任务开始 private void livTaskView_OnTaskStart(object sender, Config.LogEventArgs e) { Config.TaskUnit unit = (Config.TaskUnit)sender; //判断选项卡集合中是否已经存在 foreach (TabPage page in this.tabContent.TabPages) { if (page.Text.Equals(unit.TaskConfig.Name)) { this.tabContent.SelectedTab = page; return; } } //添加一个新的选项卡 Utility.TaskResultLog fromLogPanel = new Utility.TaskResultLog(unit.TaskConfig.Name, unit.TaskConfig.ExtractionRules); this.tabContent.TabPages.Add(fromLogPanel); this.tabContent.SelectedTab = fromLogPanel; }