예제 #1
0
 private void cmbTask_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     //If the user selects a different task, load the correct information
     try
     {
         cmbTask.Text = cmbTask.SelectedItem.ToString();
         //Take selected item from list and return the task object for information
         Task SelectedTask = ModelView.taskFromName(cmbTask.Text);
         try
         {
             txtTaskName.Text        = SelectedTask.TaskName;
             txtTaskDescription.Text = SelectedTask.TaskDescription;
             txtTaskLength.Text      = SelectedTask.TaskLength.ToString();
         }
         catch (Exception)
         {
             //If this is the first time SelectedTask will be null
             Trace.WriteLine("Error loading selected task");
         }
     }
     catch (Exception)
     {
         Trace.WriteLine("Error loading combo box items for cmbTask");
     }
 }
예제 #2
0
 private void btnSaveTaskChanges_Click(object sender, RoutedEventArgs e)
 {
     //If user clicks save, edit task accordingly
     DatabaseHandler.editTask(txtTaskName.Text, txtTaskDescription.Text, Convert.ToInt32(txtTaskLength.Text), ModelView.taskFromName(cmbTask.Text));
 }