Пример #1
0
        private void lstCourses_Drop(object sender, System.Windows.DragEventArgs e)
        {
            try
            {
                if (e.Data.GetDataPresent("ListViewItem"))
                {
                    ListViewItem    semester = e.Data.GetData("ListViewItem") as ListViewItem;
                    ListView        listView = sender as ListView;
                    SemesterControl control  = GetSemesterControlFromListView(listView);
                    //int indexOf = mSemesters.IndexOf(control);
                    //string course = CourseCanBeTaken(semester.Content.ToString(), indexOf);
                    //if (course == "")
                    //{
                    //    listView.Items.Add(semester);
                    //    int end = mSemesters.IndexOf(control);

                    //    int start = mSemesters.IndexOf(GetSemesterControlFromListView(mDraggedParent));
                    //    if (start < end)
                    //        Verify(start, end);
                    //    else
                    //        Verify(end, start);
                    //}
                    //else
                    //{
                    //    System.Windows.Forms.MessageBox.Show("Course cannot be moved to that semester.  Prerequisite class " + course + " has not yet been taken.");
                    //    mDraggedParent.Items.Add(mDraggedClass);
                    //}

                    // contact.Background = System.Windows.Media.Brushes.Aqua;
                }
            }
            catch { }
        }
Пример #2
0
        private void lstCourses_Drop(object sender, System.Windows.DragEventArgs e)
        {
            try
            {
                if (e.Data.GetDataPresent("System.Windows.Controls.ListViewItem"))
                {
                    System.Windows.Controls.ListViewItem semester = e.Data.GetData("System.Windows.Controls.ListViewItem") as System.Windows.Controls.ListViewItem;
                    System.Windows.Controls.ListView     listView = sender as System.Windows.Controls.ListView;
                    SemesterControl control = GetSemesterControlFromListView(listView);
                    int             indexOf = mSemesters.IndexOf(control);
                    string          course  = CourseCanBeTaken(semester.Content.ToString(), indexOf);
                    if (course == "")
                    {
                        listView.Items.Add(semester);
                    }
                    else
                    {
                        System.Windows.Forms.MessageBox.Show("Course cannot be moved to that semester.  Prerequisite class " + course + " has not yet been taken.");
                        mDraggedParent.Items.Add(mDraggedClass);
                    }

                    // contact.Background = System.Windows.Media.Brushes.Aqua;
                }
            }
            catch { }
        }
Пример #3
0
        //constructor.  sets up fall, spring, and summer semetsrs
        public OneYearViews(string title)
        {
            InitializeComponent();
            Semesters = new List <SemesterControl>();
            SemesterControl fall = new SemesterControl("Fall");

            fall.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            Grid.SetColumn(fall, 0);
            gridMain.Children.Add(fall);
            Semesters.Add(fall);

            SemesterControl spring = new SemesterControl("Spring");

            spring.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            Grid.SetColumn(spring, 1);
            gridMain.Children.Add(spring);
            Semesters.Add(spring);

            SemesterControl summer = new SemesterControl("Summer");

            summer.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            Grid.SetColumn(summer, 2);
            gridMain.Children.Add(summer);
            Semesters.Add(summer);

            txtHeader.Text = title;
        }
Пример #4
0
        void CoursesListView_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            SemesterControl control = GetSemesterControlFromListView(sender as System.Windows.Controls.ListView);
            int             index   = mSemesters.IndexOf(control);

            for (int i = 0; i < mSemesters.Count; i++)
            {
                if (i != index)
                {
                    mSemesters[i].CoursesListView.SelectionChanged -= CoursesListView_SelectionChanged;
                    //control.CoursesListView.SelectedItems.Clear();
                    mSemesters[i].CoursesListView.SelectedItems.Clear();
                    mSemesters[i].CoursesListView.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(CoursesListView_SelectionChanged);
                }
            }
        }
Пример #5
0
        private void lstCourses_Drop(object sender, System.Windows.DragEventArgs e)
        {
            try
            {
                if (e.Data.GetDataPresent("ListViewItem"))
                {
                    ListViewItem    courseItem = e.Data.GetData("ListViewItem") as ListViewItem;
                    ListView        listView   = sender as ListView;
                    SemesterControl control    = GetSemesterControlFromListView(listView);
                    int             indexOf    = mSemesters.IndexOf(control);
                    string          course     = CourseCanBeTaken(courseItem.Content.ToString(), indexOf);
                    if (course == "")
                    {
                        try
                        {
                            ListView    parent1 = courseItem.Parent as ListView;
                            Expander    parent2 = parent1.Parent as Expander;
                            ClassListUI parent3 = parent2.Parent as ClassListUI;

                            parent1.Items.Remove(courseItem);
                        }
                        catch
                        {
                            //means it is another semester
                        }
                        listView.Items.Add(courseItem);
                        int end = mSemesters.IndexOf(control);

                        int start = mSemesters.IndexOf(GetSemesterControlFromListView(mDraggedParent));
                        if (Verify())
                        {
                            MessageBox.Show("Warning:  Degree now contains a schedule in which course(s) are taken before prerequisite.  Schedule may be impossible." + Environment.NewLine +
                                            "Invalid course selections will be marked in yellow.");
                        }
                    }
                    else
                    {
                        System.Windows.Forms.MessageBox.Show("Course cannot be moved to that semester.  Prerequisite class " + course + " has not yet been taken.");
                        mDraggedParent.Items.Add(mDraggedClass);
                    }

                    // contact.Background = System.Windows.Media.Brushes.Aqua;
                }
            }
            catch { }
        }
Пример #6
0
        void CoursesListView_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            SemesterControl control = GetSemesterControlFromListView(sender as System.Windows.Controls.ListView);
            int             index   = mSemesters.IndexOf(control);

            for (int i = 0; i < mSemesters.Count; i++)
            {
                if (i != index)
                {
                    mSemesters[i].CoursesListView.SelectionChanged -= CoursesListView_SelectionChanged;
                    //control.CoursesListView.SelectedItems.Clear();
                    mSemesters[i].CoursesListView.SelectedItems.Clear();
                    mSemesters[i].CoursesListView.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(CoursesListView_SelectionChanged);
                }
            }
            ListViewItem temp = control.CoursesListView.SelectedItem as ListViewItem;

            if (temp != null)
            {
                mParent.showCourseInfo(temp.Content.ToString());
            }
        }