Exemple #1
0
        private void editTask(int task_index, Task task)
        {
            this.stopTask();
            // Copy the task so they don't edit the original copy
            Task taskNew = new Task(task.Serialize());
            // Don't display on top any more, otherwise forces self on top of new window
            bool wasOnTop = this.TopMost;

            this.TopMost = false;
            using (TaskEdit taskEdit = new TaskEdit(this.taskList, taskNew)) {
                DialogResult result = taskEdit.ShowDialog();
                if (result != DialogResult.OK)
                {
                    this.TopMost = wasOnTop;
                    return;
                }
                this.taskList.ReplaceTask(task_index, taskEdit.Task);

                this.populateProjects();
                this.populateProjectTasks();
                this.comboBoxProjectTasks.SelectedValue = taskEdit.Task.Project;
            }
            this.fileHandler.SaveTasks(this.taskList.Serialize());
            this.TopMost = wasOnTop;
        }
Exemple #2
0
		private void editTask(int task_index, Task task) {
			this.stopTask();
			// Copy the task so they don't edit the original copy
			Task taskNew = new Task(task.Serialize());
			// Don't display on top any more, otherwise forces self on top of new window
			bool wasOnTop = this.TopMost;
			this.TopMost = false;
			using (TaskEdit taskEdit = new TaskEdit(this.taskList, taskNew)) {
				DialogResult result = taskEdit.ShowDialog();
				if (result != DialogResult.OK) {
					this.TopMost = wasOnTop;
					return;
				}
				this.taskList.ReplaceTask(task_index, taskEdit.Task);

				this.populateProjects();
				this.populateProjectTasks();
				this.comboBoxProjectTasks.SelectedValue = taskEdit.Task.Project;
			}
			this.fileHandler.SaveTasks(this.taskList.Serialize());
			this.TopMost = wasOnTop;

		}