private void Add_Prof_Click(object sender, RoutedEventArgs e)
        {
            AddProfessorDialog addProfDialog = new AddProfessorDialog();

            addProfDialog.Owner = this;
            addProfDialog.ShowDialog();

            ProfessorList professors = (ProfessorList)Application.Current.Resources["Professor_List_View"];

            if ((bool)Application.Current.Resources["Set_Prof_Success"])
            {
                // Get data about new professor
                string fName       = (string)Application.Current.Resources["Set_Prof_FN"];
                string lName       = (string)Application.Current.Resources["Set_Prof_LN"];
                string id          = (string)Application.Current.Resources["Set_Prof_ID"];
                string colorString = (string)Application.Current.Resources["Set_Prof_Color"];
                // Create new professor object and add to professor list
                Professors prof = new Professors(fName, lName, id);
                prof.profRGB = new RGB_Color(colorString);
                professors.Add(prof);
                // Set the new professor as the comboBox selected value
                Prof_Text.SelectedIndex = (professors.Count - 1);
                // Reset Success flag for the addProfessorDialog
                Application.Current.Resources["Set_Prof_Success"] = false;
            }
        }
Example #2
0
        public EditClassDialog(Classes _class)
        {
            InitializeComponent();
            Application.Current.Resources["Set_Class_Success"] = false;
            Application.Current.Resources["Edit_Class_Check"]  = false;
            targetClass      = _class;
            originalCRN      = _class.CRN;
            originalOnline   = _class.Online;
            originalAssigned = _class.isAssigned;
            ProfessorList profs = (ProfessorList)Application.Current.FindResource("Professor_List_View");

            Prof_Text.ItemsSource = profs;

            oldProfessor = _class.Prof;

            // Initialize fields with available data from class
            Classes c1 = _class;

            CRN_Text.Text      = _class.CRN.ToString();
            Dept_Text.Text     = _class.DeptName;
            ClassNum_Text.Text = _class.ClassNumber.ToString();
            Section_Text.Text  = _class.SectionNumber.ToString();
            Name_Text.Text     = _class.ClassName;
            Credits_Text.Text  = _class.Credits.ToString();
            int profIndex;

            for (profIndex = 0; profIndex < profs.Count; profIndex++)
            {
                if (profs[profIndex].FullName == _class.Prof.FullName)
                {
                    break;
                }
            }
            Prof_Text.SelectedIndex = profIndex;
            if (_class.Online)
            {
                Online_Box.IsChecked = true;
            }
            else if (_class.isAppointment)
            {
                if (_class.Classroom.Location == "APPT")
                {
                    Appointment_Box.IsChecked = true;
                }
                else
                {
                    Appointment2_Box.IsChecked = true;
                }
            }
            else
            {
                InClass_Box.IsChecked = true;
            }
            //MessageBox.Show("excludeCredits: " + _class.excludeCredits);
        }