/// <summary> /// Auto-save work on exit. /// </summary> /// <param name="e">Contains the arguments for the Exit event.</param> protected override void OnExit(ExitEventArgs e) { SaveBase saveWork = new SaveBase(); saveWork.SaveWork(); base.OnExit(e); }
/// <summary> /// Commit the reassigned room to the course. /// </summary> /// <param name="sender">A reference to the control/object that raised the event.</param> /// <param name="e">State information and event data associated with a routed event.</param> void CommitReassign(Object sender, RoutedEventArgs e) { string[] coursestoassign; string[] roomstoassign; string[] coursesections; LinkedReassignments node = ReassignPaths.SelectedItem as LinkedReassignments; // Splits the strings coursestoassign = node.courseSteps.Split(','); roomstoassign = node.roomSteps.Split(','); coursesections = node.courseSections.Split(','); for (int i = 0; i < roomstoassign.Length; i++) { if (node.steps == 0) { MessageBox.Show("You can not reassign with this item!"); break; } else if (i != 0 && i % 2 == 1) { var thecourse = from course in CourseRepo.Courses where course.CourseName == coursestoassign[i] && course.SectionNumber == coursesections[i] select course; var theroom = from room in RoomRepo.Rooms where room.RoomName == roomstoassign[i] select room; foreach (Course course in thecourse) { foreach (Room room in theroom) { System.Diagnostics.Debug.WriteLine("Course is: " + course.CourseName + " assigned to " + room.RoomName); course.Room = room.RoomName; course.RoomAssignment = room; } } } } MessageBox.Show("Reassigned rooms to courses"); saveWork.SaveWork(); }
/// <summary> /// Save work onto file. /// </summary> /// <param name="sender">A reference to the control/object that raised the event.</param> /// <param name="e">State information and event data associated with a routed event.</param> void OnClickSave(object sender, RoutedEventArgs e) { saveWork.SaveWork(); }
/// <summary> /// Save all work to most recently opened or created assignment/.agn file from the file menu item. /// </summary> /// <param name="sender">A reference to the control/object that raised the event.</param> /// <param name="e">State information and event data.</param> private void Menu_Save(object sender, EventArgs e) { saveWork.SaveWork(); }