private void ParkButton_Click(object sender, EventArgs e) { //Do everything the same as "Close" but minimize the form instead LogXDataBase lgdb = new LogXDataBase(); if (NotesTextBox.Text != null) { lgdb.AddNote(LogDateTimePicker.Value.ToShortDateString(), NotesTextBox.Text); } List <string> taskList = new List <string>(); foreach (DataGridViewRow task in TaskDataGrid.Rows) { var taskName = task.Cells[0].Value; if (taskName != null) { bool taskDone = Convert.ToBoolean(task.Cells[1].Value); if (!taskDone && (taskName != null)) { taskList.Add(taskName.ToString()); } } } lgdb.AddTasks(taskList); this.WindowState = FormWindowState.Minimized; return; }
private void CloseButton_Click(object sender, EventArgs e) { LogXDataBase lgdb = new LogXDataBase(); if (NotesTextBox.Text != null) { lgdb.AddNote(LogDateTimePicker.Value.ToShortDateString(), NotesTextBox.Text); } List <string> taskList = new List <string>(); foreach (DataGridViewRow task in TaskDataGrid.Rows) { var taskName = task.Cells[0].Value; if (taskName != null) { bool taskDone = Convert.ToBoolean(task.Cells[1].Value); if (!taskDone && (taskName != null)) { taskList.Add(taskName.ToString()); } } } lgdb.AddTasks(taskList); Close(); return; }