Beispiel #1
0
        public void EditTask(ListViewItem task)
        {
            Task currTask = null;

            foreach (Task taskk in Project.Tasks)
            {
                if (taskk.lvm == task)
                    currTask = taskk;
            }

            if (currTask == null)
                return;

            var taskEdit = new frmAddEditTask
                               {
                                   txtTaskName = {Text = currTask.Text},
                                   cmbPriority = {SelectedIndex = (int) currTask.Priority}
                               };

            if (taskEdit.ShowDialog() == DialogResult.OK)
            {
                currTask.Text = taskEdit.txtTaskName.Text;
                if (taskEdit.cmbPriority.SelectedIndex == -1)
                    taskEdit.cmbPriority.SelectedIndex = 2;

                currTask.Priority = (Task.TaskPriority) taskEdit.cmbPriority.SelectedIndex;
                _taskList.Reload();
            }
        }
Beispiel #2
0
        public void AddTask()
        {
            var taskEdit = new frmAddEditTask();
            if (taskEdit.ShowDialog() != DialogResult.OK) return;
            var task = new Task();
            if (taskEdit.cmbPriority.SelectedIndex == -1)
                taskEdit.cmbPriority.SelectedIndex = 2;

            task.Priority = (Task.TaskPriority) taskEdit.cmbPriority.SelectedIndex;
            task.Text = taskEdit.txtTaskName.Text;
            Project.Tasks.Add(task);
            _taskList.Reload();
        }