コード例 #1
0
 public static CartAndScheduleEntry AddToCart(CartAndScheduleEntry entry)
 {
     instance.cart.Insert(0, entry);
     if (instance.visibleSemesters.Contains(entry.SemesterObject))
     {
         instance.visible.Insert(0, entry);
         NotifyChange(NotifyCollectionChangedAction.Add, entry);
     }
     return(entry);
 }
コード例 #2
0
 public static void AddToSchedule(CartAndScheduleEntry entry)
 {
     Console.WriteLine("Moving this course to schedule");
     instance.schedule.Insert(0, entry);
     if (instance.visibleSemesters.Contains(entry.SemesterObject))
     {
         instance.visible.Insert(0, entry);
         NotifyChange(NotifyCollectionChangedAction.Add, entry);
     }
 }
コード例 #3
0
 private static void NotifyChange(NotifyCollectionChangedAction action, CartAndScheduleEntry entry)
 {
     if (instance.CollectionChanged != null)
     {
         instance.CollectionChanged(instance, new NotifyCollectionChangedEventArgs(action));
         Console.WriteLine("Notified change in cart");
     }
     else
     {
         Console.WriteLine("Did not notify change in cart");
     }
 }
コード例 #4
0
        public void Execute(object parameter)
        {
            Offering selected = course.SelectedOffering();

            if (selected != null)
            {
                CourseSelectorCourses.RemoveCourse(course);
                CartAndScheduleEntry entry = CartSelections.AddToCart(course);
                Messages.AddUndoMessage("Added " + course.Department + " " + course.Number + " in " + entry.Semester + " to Cart", () => CartSelections.RemoveFromCart(entry));
            }
            else
            {
                MessageBox.Show("Please ensure all sections (lecture/tutorial/lab) are selected for the course you wish to add");
            }
        }
コード例 #5
0
 public static void RemoveFromSchedule(CartAndScheduleEntry entry)
 {
     if (instance.visible.Contains(entry))
     {
         instance.visible.Remove(entry);
         if (instance.CollectionChanged != null)
         {
             instance.CollectionChanged(instance, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, entry));
         }
     }
     if (instance.schedule.Contains(entry))
     {
         instance.schedule.Remove(entry);
     }
 }
コード例 #6
0
        public static CartAndScheduleEntry AddToCart(Course course)
        {
            Console.WriteLine("Moving this course to cart");

            Offering selected       = course.SelectedOffering();
            Section  chosenLecture  = selected.Lecture;
            Section  chosenTutorial = null;
            Section  chosenLab      = null;

            if (selected.Tutorials.Count > 0)
            {
                foreach (Section tutorial in selected.Tutorials)
                {
                    if (tutorial.IsChecked == true)
                    {
                        chosenTutorial = tutorial;
                        break;
                    }
                }
            }
            if (selected.Labs.Count > 0)
            {
                foreach (Section lab in selected.Labs)
                {
                    if (lab.IsChecked == true)
                    {
                        chosenLab = lab;
                        break;
                    }
                }
            }
            CartAndScheduleEntry entry = new CartAndScheduleEntry(course.Department, course.Number, course.Title, course.Semester, course.SemesterObject, chosenLecture, chosenLab, chosenTutorial);

            instance.cart.Insert(0, entry);
            if (instance.visibleSemesters.Contains(entry.SemesterObject))
            {
                instance.visible.Insert(0, entry);
                NotifyChange(NotifyCollectionChangedAction.Add, entry);
            }
            return(entry);
        }
コード例 #7
0
 public void reverseEnroll(CartAndScheduleEntry entry)
 {
     entry.UpdateRemoveFromCart();
     CartSelections.AddToCart(entry);
     ScheduleSelections.RemoveFromSchedule(entry);
 }
コード例 #8
0
 public EnrollCourseCommand(CartAndScheduleEntry entry)
 {
     this.entry = entry;
 }
コード例 #9
0
 public RemoveFromCartCommand(CartAndScheduleEntry entry)
 {
     this.entry = entry;
 }