private void Lbl_tianjia_Click(object sender, EventArgs e) { WinForm.WinFromAddTask mywin = new WinForm.WinFromAddTask(); if (mywin.ShowDialog() == DialogResult.OK) { dgv_task.Rows.Clear(); List <string> list_files = mywin.outvalue; int id = 0; //将list_files形成任务列表中的控件 for (int i = 0; i < list_files.Count; i++) { string item = list_files[i]; //判断文件是否是隐藏文件 FileInfo myfi = new FileInfo(item); if ((myfi.Attributes & FileAttributes.Hidden) != FileAttributes.Hidden) { //UCTask myuc = new UCTask(item) { Dock = DockStyle.Top }; //UIHelper.AddControl(panel_task, myuc); //startall += myuc.SearchRepeat; //stopall += myuc.StopResearch; int index = dgv_task.Rows.Add(); dgv_task.Rows[index].Cells["wenjianming"].Value = item; dgv_task.Rows[index].Cells["xuhao"].Value = ++id; } } } }
/// <summary> /// 点击添加任务按钮时出发的事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lbl_addtask_Click(object sender, EventArgs e) { /*弹出选择任务窗体,根据选择的结果再任务panel中显示所有任务*/ WinForm.WinFromAddTask mywinform = new WinForm.WinFromAddTask(); if (mywinform.ShowDialog() == DialogResult.OK) { dgv_task.Rows.Clear(); List <string> list_files = mywinform.outvalue; UCTask myuc = null; //将list_files形成任务列表中的控件 for (int i = 0; i < list_files.Count; i++) { string item = list_files[i]; myuc = new UCTask(item) { Dock = DockStyle.Top }; uihelper.AddControl(panel_task, myuc); _startall += myuc.ZhengwenChachong; _stopall += myuc.StopResearch; //int index = dgv_task.Rows.Add(); //dgv_task.Rows[index].Cells["wendangming"].Value = item; //dgv_task.Rows[index].Cells["xuhao"].Value = i + 1; } } }