private void buttonAccept_Click(object sender, EventArgs e) { List <Types.SingleTask> tasks = new List <SingleTask>(); //Defensive way foreach (Control c in panel1.Controls) { if (c is TaskControl) { //add to the tasks list tasks.Add( //we need to first type cast 'c' ((TaskControl)c).GetTask() ); } } //Lazy way //foreach (TaskControl tc in panel1.Controls) //{ // tasks.Add(tc.GetTask()); //} TaskControlAcceptedEventArgs te = new TaskControlAcceptedEventArgs(tasks); OnAccept(this, te); }
private void buttonAccept_Click(object sender, EventArgs e) { List<Types.SingleTask> tasks = new List<SingleTask>(); //Defensive way foreach(Control c in panel1.Controls) { if(c is TaskControl) { //add to the tasks list tasks.Add( //we need to first type cast 'c' ((TaskControl)c).GetTask() ); } } //Lazy way //foreach (TaskControl tc in panel1.Controls) //{ // tasks.Add(tc.GetTask()); //} TaskControlAcceptedEventArgs te = new TaskControlAcceptedEventArgs(tasks); OnAccept(this, te); }
private void handleAcceptButton(object s, TaskControlAcceptedEventArgs e) { List<SingleTask> tasks = e.TasksList; Ts = e.TasksList; this.Close(); }