Esempio n. 1
0
        // Make rectangle
        public void OnGridPlace(bool SetHeight = false)
        {
            BG.RadiusX          = 0;
            BG.RadiusY          = 0;
            SectionType.Content = name + " " + type;
            placedOnce          = true;
            onGrid = true;

            for (int i = 0; i < sections.Length; i++)
            {
                for (int j = 0; j < sections[i].Length; j++)
                {
                    GridSection g = sections[i][j];
                    if (Grid.GetRow(g) == Grid.GetRow(this) && Grid.GetColumn(g) == Grid.GetColumn(this))
                    {
                        Grid.SetRowSpan(this, Grid.GetRowSpan(g));
                        g.SetStay(true);
                        g.HighlightConnected();
                        g.ShowConnected();
                        if (SetHeight)
                        {
                            Height = g.Height;
                        }
                        break;
                    }
                    else
                    {
                        g.SetStay(false);
                        g.ShadowConnected();
                        g.HideConnected();
                    }
                }
            }

            if (originalParent.Children.Count == 0)
            {
                searchParent.Dragging_Info.Visibility = Visibility.Collapsed;
                bool alreadyPlaced = false;
                foreach (UIElement ui in window.ListOfCourses.Children)
                {
                    CourseListItem cli = ui as CourseListItem;
                    if (cli != null && cli.name == name)
                    {
                        alreadyPlaced = true;
                        break;
                    }
                }

                if (!alreadyPlaced)
                {
                    window.ListOfCourses.Children.Add(new CourseListItem(this, other, window));
                }
            }
        }
Esempio n. 2
0
 private void CourseList_Clear(string name)
 {
     foreach (UIElement ui in ListOfCourses.Children)
     {
         CourseListItem cli = ui as CourseListItem;
         if (cli != null && cli.name.Equals(name))
         {
             cli.SetEnrollment(false);
             ListOfCourses.Children.Remove(cli);
             break;
         }
     }
 }
Esempio n. 3
0
        // confirmation window
        private void Enroll_Click(object sender, RoutedEventArgs e)
        {
            List <CourseListItem> addList  = new List <CourseListItem>();
            List <CourseListItem> dropList = new List <CourseListItem>();

            foreach (UIElement ui in ListOfCourses.Children)
            {
                CourseListItem cli = ui as CourseListItem;
                if (cli != null)
                {
                    if (cli.isChecked)
                    {
                        addList.Add(cli);
                    }
                    else
                    {
                        if (enrolled.Contains(cli))
                        {
                            dropList.Add(cli);
                        }
                    }
                }
            }

            string prompt = "";
            bool   allIn  = true;

            foreach (CourseListItem cli in addList)
            {
                if (!enrolled.Contains(cli) || !cli.enrolled)
                {
                    allIn = false;
                    break;
                }
            }
            foreach (CourseListItem cli in enrolled)
            {
                if (!addList.Contains(cli) || !cli.enrolled)
                {
                    allIn = false;
                    break;
                }
            }
            if (allIn)
            {
                prompt = "Are you sure you want to confirm enrollment?";
            }
            else
            {
                if (addList.Count > 0)
                {
                    prompt += "Are you sure you want to enroll in the following courses?";
                    foreach (CourseListItem cli in addList)
                    {
                        prompt += "\n\t" + cli.name;
                    }
                }

                if (dropList.Count > 0)
                {
                    if (addList.Count > 0)
                    {
                        prompt += "\nAnd drop the following courses?";
                    }
                    else
                    {
                        prompt += "Are you sure you want to drop the following courses?";
                    }
                    foreach (CourseListItem cli in dropList)
                    {
                        prompt += "\n\t" + cli.name;
                    }
                }
            }

            ConfirmationWin win = CreateWindow("Confirming Enrollment", prompt);

            win.ShowDialog();

            if (ConfirmResult)
            {
                enrolled = addList;
                foreach (CourseListItem cli in addList)
                {
                    cli.SetEnrollment(true);
                }
                foreach (CourseListItem cli in dropList)
                {
                    cli.SetEnrollment(false);
                }
            }
        }