private void EditTask() { // Show Modal Dialog var dlg = new TodoDetailedWindow(); dlg.Title = "Edit Task"; // Need a temp to-do in case of cancel TodoItem tempItem = new TodoItem(); tempItem.Title = currentTask.Title; tempItem.Description = currentTask.Description; tempItem.Priority = currentTask.Priority; tempItem.CreationDate = currentTask.CreationDate; tempItem.DueDate = currentTask.DueDate; tempItem.Done = currentTask.Done; dlg.DataContext = tempItem; if (dlg.ShowDialog() == true) { currentTask.Title = tempItem.Title; currentTask.Description = tempItem.Description; currentTask.Priority = tempItem.Priority; currentTask.CreationDate = tempItem.CreationDate; currentTask.DueDate = tempItem.DueDate; currentTask.Done = tempItem.Done; dirty = true; } }
private void AddTask() { // Show Modal Dialog var dlg = new TodoDetailedWindow(); dlg.Title = "Add New Task"; TodoItem newItem = new TodoItem(); dlg.DataContext = newItem; if (dlg.ShowDialog() == true) { Add(newItem); CurrentViewIndex = 0; CurrentTask = newItem; dirty = true; NotifyPropertyChanged("Count"); } }