private void Add_Button_Click(object sender, RoutedEventArgs e) { if (Name_Field.Text.Length > 0 && Dean_Box.SelectedIndex != -1 && NameError.Visibility != Visibility.Visible) { NameError.Visibility = Visibility.Hidden; DeanError.Visibility = Visibility.Hidden; faculty.Name = Name_Field.Text; faculty.University = dbl.LoggedPerson.University; faculty.Deans.Add(deans[Dean_Box.SelectedIndex]); dbl.AddFaculty(faculty); Added_Event(); } else if (Name_Field.Text.Length > 0 && NameError.Visibility != Visibility.Visible) { NameError.Visibility = Visibility.Hidden; DeanError.Visibility = Visibility.Hidden; faculty.Name = Name_Field.Text; faculty.University = dbl.LoggedPerson.University; dbl.AddFaculty(faculty); Added_Event(); } else if (Name_Field.Text.Length > 0) { NameError.Visibility = Visibility.Hidden; DeanError.Visibility = Visibility.Visible; } else { DeanError.Visibility = Visibility.Hidden; NameError.Visibility = Visibility.Visible; } }