private void add_click(object sender, RoutedEventArgs e) //adds the assignments to the list and the listview { Builder build = new Info_Builder(); if (Assigntitle.Text == "" || Classbox.Text == "") { MessageBox.Show("Assignment title and course selection needed."); return; } if (monthbox.Text == "" || daybox.Text == "" || yearbox.Text == "") { monthbox.Text = "-"; daybox.Text = "-"; yearbox.Text = "-"; } string date = monthbox.Text + "/" + daybox.Text + "/" + yearbox.Text; Assignment homework = build.Assignment_build(Assigntitle.Text, Classbox.Text, date, notes.Text); Classbox.Text = ""; Assigntitle.Text = ""; daybox.Text = ""; monthbox.Text = ""; yearbox.Text = ""; notes.Text = ""; viewAssignmentList.Items.Add(homework); MyAssignments.Add(homework); addassign.Content = "Add Assignment"; }
private void open_assignments_file() //opens the file of assignments { using (var file = new System.IO.StreamReader(@"saves\StudentAssignments.txt")) { string line; while ((line = file.ReadLine()) != null) { Assignment homework = new Assignment(); homework.AssignName = line; line = file.ReadLine(); homework.Notes = line; line = file.ReadLine(); homework.ClassName = line; line = file.ReadLine(); homework.DueDate = line; if (MyClasses.Contains(homework.ClassName)) { MyAssignments.Add(homework); viewAssignmentList.Items.Add(homework); } } } }
private void incomplete_Click(object sender, RoutedEventArgs e) //uer clicks to mark assignment as incomplete { if (viewCompletedAssignments.SelectedItems.Count == 0) { MessageBox.Show("No assignment selected."); return; } Assignment homework = (Assignment)viewCompletedAssignments.SelectedItems[0]; MyAssignments.Add(homework); viewAssignmentList.Items.Add(homework); viewCompletedAssignments.Items.Remove(homework); Completed.Remove(homework); save_completed(); save_to_file(); }