private void loadTask(Task task) { view.TaskName = task.Name; view.Priority = task.Priority; view.StartDate = task.StartDate; view.DueDate = task.DueDate; view.Completed = task.Completed; view.CompletionDate = task.CompletionDate; this.isNew = false; }
private void Save(object sender, EventArgs e) { Task task; if (this.isNew) { task = new Task(); } else { task = tasks[currentIndex]; } task.Name = view.TaskName; task.Priority = view.Priority; task.StartDate = view.StartDate; task.DueDate = view.DueDate; task.Completed = view.Completed; task.CompletionDate = view.CompletionDate; if (this.isNew) { tasks.Add(task); this.isNew = false; currentIndex = tasks.Count - 1; } view.isDirty = false; view.StatusChange = "Task saved"; }