Exemple #1
0
        private void addSubtaskToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Task     selectedTask = xml.TaskDictionary[this.tasksTreeView.SelectedNode];
            TreeNode subTaskNode  = selectedTask.AddSubtask();

            this.tasksTreeView.SelectedNode.Nodes.Add(subTaskNode);
            this.tasksTreeView.ExpandAll();
            xml.AtLeastOneTaskChanged();
        }
Exemple #2
0
 private void addTaskButton_Click(object sender, EventArgs e)
 {
     //need to perform check if task or subtask to be created
     //depend on current selected node (root or existed task)
     if (tasksTreeView.SelectedNode != null)
     {
         if (String.Compare(tasksTreeView.SelectedNode.Text, rootNodeName) == 0)
         {
             //root element-> add new task
             TreeNode newNode = xml.AddNewTask();
             this.tasksTreeView.Nodes[0].Nodes.Add(newNode);
             xml.AtLeastOneTaskChanged();
         }
         else if (this.tasksTreeView.SelectedNode.Level == 1) //extra check for case when trying to create new subtask for subtask
         {
             //task element-> add subtask
             Task     selectedTask = xml.TaskDictionary[this.tasksTreeView.SelectedNode];
             TreeNode subTaskNode  = selectedTask.AddSubtask();
             this.tasksTreeView.SelectedNode.Nodes.Add(subTaskNode);
             this.tasksTreeView.ExpandAll();
             xml.AtLeastOneTaskChanged();
         }
     }
 }