private void optionEditSubtasks_Click(object sender, EventArgs e) { if (ActiveTarget.HasSubtasks()) { List<string> Names = new List<string>(); List<int> Weights = new List<int>(); foreach (Task task in ActiveTarget.Subtasks) { Names.Add(task.Name); Weights.Add(task.Weight); } var AddSubtasksForm = new AddSubtasks(ActiveTarget.Name, ActiveTarget.Description, Names, Weights); AddSubtasksForm.ShowDialog(); if (AddSubtasksForm.Success) { ActiveTarget.Subtasks.Clear(); ActiveTarget.AddSubtasks(AddSubtasksForm.SubNames.Count, AddSubtasksForm.SubNames.ToArray(), AddSubtasksForm.Description, AddSubtasksForm.SubWeights.ToArray(), AddSubtasksForm.SubWeights.ToArray()); } tasksTreeView.RefreshObject(ActiveTarget); } }
private void optionAdd_Click(object sender, EventArgs e) { var AddSubtasksForm = new AddSubtasks(ActiveTarget.Name); AddSubtasksForm.ShowDialog(); if (AddSubtasksForm.Success) ActiveTarget.AddSubtasks(AddSubtasksForm.SubNames.Count, AddSubtasksForm.SubNames.ToArray(), AddSubtasksForm.Description, AddSubtasksForm.SubWeights.ToArray(), AddSubtasksForm.SubWeights.ToArray()); tasksTreeView.RefreshObject(ActiveTarget); }