private void btnAdd_Click(object sender, System.EventArgs e) { using (var taskDialog = new Form2()) { taskDialog.StartDate = calendar.SelectionStart; taskDialog.Deadline = calendar.SelectionEnd; if (taskDialog.ShowDialog() == DialogResult.OK) { if (!string.IsNullOrWhiteSpace(taskDialog.FormName)) { var newTask = new Task() { Name = taskDialog.FormName, Deadline = taskDialog.Deadline, StartDate = taskDialog.StartDate, Status = 0, }; store.Create(newTask); AddTask(newTask); } } } }
private void NewTaskDialog() { using (var taskDialog = new FormTask()) { taskDialog.StartDate = calendar.SelectionStart; taskDialog.Deadline = calendar.SelectionEnd; if (taskDialog.ShowDialog() == DialogResult.OK) { if (!string.IsNullOrWhiteSpace(taskDialog.TaskName)) { var newTask = new Task() { Name = taskDialog.TaskName, Deadline = taskDialog.Deadline, StartDate = taskDialog.StartDate, Status = TaskStatus.New }; store.Create(newTask); AddTask(newTask); } } } }
public void AddTaskToStore(Task item) { store.Create(item); }