예제 #1
0
 private void LoggedHandler(Object sender, LogginEventArgs e)
 {
     RequestResults result = CheckUser(e.userName, e.password);
     switch (result)
     { 
         case RequestResults.Student:
             this.Visibility = Visibility.Hidden;
             setNormalSize();
             StudentWindow studentWindow = new StudentWindow();
             studentWindow.WindowClosed += ExitApplication;
             frmMainContent.Content = studentWindow;
             this.Visibility = Visibility.Visible;
             break;
         case RequestResults.Profesor:
             this.Visibility = Visibility.Hidden;
             setNormalSize();
             TeacherWindow teacherWindow = new TeacherWindow();
             teacherWindow.WindowClosed += ExitApplication;
             frmMainContent.Content = teacherWindow;
             this.Visibility = Visibility.Visible;
             break;
         case RequestResults.Master:
             this.Visibility = Visibility.Hidden;
             setNormalSize();
             AdministratorWindow administratorWindow = new AdministratorWindow();
             administratorWindow.WindowClosed += ExitApplication;
             frmMainContent.Content = administratorWindow;
             this.Visibility = Visibility.Visible;
             break;
         case RequestResults.None:
             logginWindow.setWarningVisible();
             break;
     }
 }
예제 #2
0
 private void Login_Click(object sender, EventArgs e)
 {
     if (Student.Checked)
     {
         if (!StudentList.Recorded(NameBox.Text))
         {
             StudentList.AddStudent(NameBox.Text);
         }
         Form StudentsWindow = new StudentsWindow(Courses, NameBox.Text);
         NameBox.Clear();
         StudentsWindow.Show();
     }
     else if (Teacher.Checked)
     {
         if (!TeacherList.Recorded(NameBox.Text))
         {
             TeacherList.AddTeacher(NameBox.Text);
         }
         Form TeachersWindow = new TeacherWindow(Courses);
         NameBox.Clear();
         TeachersWindow.Show();
     }
     else if (TechSupport.Checked)
     {
         if (!Support.Recorded(NameBox.Text))
         {
             Support.AddSupport(NameBox.Text);
         }
         Form TechSupport = new TechSupportWindow(Courses);
         NameBox.Clear();
         TechSupport.Show();
     }
 }