private void cmbProject_SelectionChanged(object sender, SelectionChangedEventArgs e) { //If the user selects a different project, load the correct information cmbProject.Text = cmbProject.SelectedItem.ToString(); //When the control is entered possible reload tasks and the changing information ModelView.taskListComboBoxHandler(cmbTask, cmbProject.Text); //Take selected item from list and return the task object for information Project SelectedProject = ModelView.projectFromName(cmbProject.Text); try { txtProjectName.Text = SelectedProject.x; txtProjectDescription.Text = SelectedProject.projectDescription; txtProjectStartDate.Text = SelectedProject.dateStarted.ToShortDateString(); } catch (Exception) { //If this is the first time SelectedProject will be null Trace.WriteLine("Error loading selected project"); } }
private void btnSaveProjectChanges_Click(object sender, RoutedEventArgs e) { //If user clicks save, edit project accordingly DatabaseHandler.editProject(txtProjectName.Text, txtProjectDescription.Text, Convert.ToDateTime(txtProjectStartDate.Text), ModelView.projectFromName(cmbProject.Text)); }