private void complete() { task.EndDate = DateTime.Now; JsonData.completeTasks.Add(task); JsonData.currentTasks.Remove(task); Form_View.clearContent(); Form_View.createListOfTasks(); }
private void removeTaskSubmitBtn_Click(object sender, EventArgs e) { string comment = commentRichTextBox.Text; task.Comment = comment; JsonData.abandonedTasks.Add(task); JsonData.currentTasks.Remove(task); Parent.Hide(); Form_View.clearContent(); Form_View.createListOfTasks(); }
private void newTaskSubmitBtn_Click(object sender, EventArgs e) { // Notify user about missing data nameReqLabel.Text = (nameTextBox.Text == "" || nameTextBox.Text == null) ? "(*) - to pole jest wymagane" : "(*)"; dateReqLabel.Text = (dateTimePicker.Value <= DateTime.Now) ? "(*) - data/godzina jest mniejsza od aktualnej" : "(*)"; importantReqLabel.Text = (!importantYesRadio.Checked && !importantNoRadio.Checked) ? "(*) - to pole jest wymagane" : "(*)"; // Check that all required fields are filled if (nameTextBox.Text != "" && nameTextBox.Text != null && dateTimePicker.Value > DateTime.Now && (importantNoRadio.Checked || importantYesRadio.Checked)) { name = nameTextBox.Text; date = dateTimePicker.Value; important = importantYesRadio.Checked ? true : false; if (task != null && isEditMode) { // Remove previously task JsonData.currentTasks.Remove(JsonData.currentTasks.Find(t => t.Id.Contains(task.Id))); } // Create and add new/edited task task = new Task(name, Category.Current, date, important); JsonData.currentTasks.Add(task); JsonData.currentTasks.Sort((t1, t2) => t1.Date.CompareTo(t2.Date)); if (isEditMode) { // Hide edit mode Parent.Hide(); Form_View.clearContent(); Form_View.createListOfTasks(); } else { // Reset fields nameTextBox.Text = null; dateTimePicker.Value = DateTime.Now; importantNoRadio.Checked = true; } } }