private void addTODO(object sender, RoutedEventArgs e) { Console.WriteLine("add TODO button"); if (cTODOTitle.Text != "" && cTODODescription.Text != "" && cTODOPriority.Text != "" && cTODOEndDatePicker.SelectedDate.Value.Date != null) { int priority = 0; switch (cTODOPriority.Text) { case "Normal": priority = 0; break; case "Soon": priority = 1; break; case "Urgent": priority = 2; break; default: priority = 0; break; } Console.WriteLine(priority + cTODOPriority.Text); DateTime EndingAt = cTODOEndDatePicker.SelectedDate.Value.Date; Management.TODO todo = new Management.TODO(cTODOTitle.Text, // TODO Title cTODODescription.Text, // TODO Description user.getID(), // User id priority, // Priority DateTime.Now.Date, // UpdatedAt DateTime.Now.Date, // CreatedAt DateTime.Now.Date, // StartingAt EndingAt // EndingAt ); TODOQuery.addTODO(todo); todoList.Items.Add(new Component.TodoListItem(todo, this)); } }
public TodoPage(AdminUser user) { this.user = user; InitializeComponent(); todos = TODOQuery.getAll(); if (todos.Count > 0) { todos.ForEach(todo => { Component.TodoListItem t = new Component.TodoListItem(todo, this); todoList.Items.Add(t); }); } else { Console.WriteLine("No todo"); } todoList.SelectionChanged += selectedTODO; }
private void clickCheckmark(object sender, RoutedEventArgs args) { // Remove todo TODOQuery.endTODO(todo); todoPage.todoList.Items.Remove(this); }