private void tmnuEditTask_Click(object sender, EventArgs e) { if (tlTasks.FocusedNode != null && tlTasks.FocusedNode.Tag != null) { using (frmTaskEditor frmEditTask = new frmTaskEditor()) { TTask editTask = (TTask)tlTasks.FocusedNode.Tag; frmEditTask.Task = editTask; frmEditTask.Text = "修改监控任务"; if (frmEditTask.ShowDialog() == DialogResult.OK) { editTask.Save(); tlTasks.FocusedNode[tclmnTaskName.AbsoluteIndex] = editTask.TaskName; tlTasks.FocusedNode[tclmnWatchType.AbsoluteIndex] = EnumHelper.GetDescription(editTask.WatchType); tlTasks.FocusedNode[tclmnMonitorFolder.AbsoluteIndex] = editTask.WatchFolder; tlTasks.FocusedNode[tclmnDocProcessType.AbsoluteIndex] = EnumHelper.GetDescription(editTask.FileDealType); tcTaskLogs.SelectedTabPage.Text = GetTaskLogPanelText(editTask); } } } }
private void tmnuNewTask_Click(object sender, EventArgs e) { using (frmTaskEditor frmNewTask = new frmTaskEditor()) { TTask newTask = new TTask(RegTaskKey, TObjectCreateType.octNew); frmNewTask.Task = newTask; frmNewTask.Text = "新增监控任务"; if (frmNewTask.ShowDialog() == DialogResult.OK) { newTask.Save(); tasks.Tasks.Add(newTask); tlTasks.AppendNode( new object[] { newTask.TaskStatusMessage, newTask.TaskName, EnumHelper.GetDescription(newTask.WatchType), newTask.WatchFolder, EnumHelper.GetDescription(newTask.FileDealType) }, null, newTask); CreateTaskLogPanel(newTask); } } }