Example #1
0
        private void addTaskButton_Click(object sender, EventArgs e)
        {
            NewTask task = new NewTask();

            task.ShowDialog();

            if (task.DialogResult == DialogResult.OK)
            {
                string newTask = task.TaskName;

                if (taskTreeView.SelectedNode != null)
                {
                    taskTreeView.SelectedNode.Nodes.Add(newTask);
                    taskTreeView.SelectedNode.Expand();
                }
                else
                {
                    taskTreeView.Nodes.Add(newTask);
                }
            }
        }
Example #2
0
        private void editTaskButton_Click(object sender, EventArgs e)
        {
            if (taskTreeView.SelectedNode == null)
            {
                MessageBox.Show("No task selected!");
            }
            else
            {
                TreeNode selectedNode = taskTreeView.SelectedNode;


                NewTask editTask = new NewTask(selectedNode.Text);
                editTask.ShowDialog();

                if (editTask.DialogResult == DialogResult.OK)
                {
                    string newTask = editTask.TaskName;

                    selectedNode.Text = newTask;
                }
            }
        }