/// <summary> /// This method calls when user click on button btnAdd and user adds a new task. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAdd_Click(object sender, EventArgs e) { Files.Task newTask = GetTaskFromUserInputs(); if (newTask != null) { taskManager.Add(newTask); UpdateGUI(); } }
/// <summary> /// This method creats a new task from user input and returns it. /// </summary> /// <returns></returns> private Files.Task GetTaskFromUserInputs() { Files.Task task; if (CheckUserInputs()) { return(task = new Files.Task(dateTimePicker.Value, (Files.PriorityType)Enum.Parse(typeof(Files.PriorityType), comboBox.SelectedItem.ToString().Replace(" ", "_")), textBox.Text)); } else { return(null); } }