private void Return_Click(object sender, RoutedEventArgs e)
        {
            LectureMenuWindow lectureMenu = new LectureMenuWindow(_userId);

            lectureMenu.Show();
            Close();;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Submits the completed test
        /// </summary>
        private void SubmitTest_Click(object sender, RoutedEventArgs e)
        {
            if (TestController.GetQuestions(_testId).Count == 0)
            {
                MessageBox.Show("Please have at least 1 question");
                return;
            }

            SubmitTestWindow submitTest = new SubmitTestWindow
            {
                SelectedTestName = TestController.GetTestName(_testId),
                Owner            = this
            };

            Effect = Utility.Blur;
            submitTest.ShowDialog();

            if (submitTest.DialogResult == true)
            {
                TestController.SetTestName(_testId, submitTest.SelectedTestName);
                LectureMenuWindow lectureMenu = new LectureMenuWindow(_userId);
                lectureMenu.Show();
                Close();
            }
        }
        private async void ButtonLogin_ClickAsync(object sender, RoutedEventArgs e)
        {
            bool   result   = int.TryParse(TextBoxUsername.Text, out int username);
            string password = TextBoxPassword.Password;

            bool works = await UserController.CredentialsMatchAsync(Convert.ToInt32(username), password);

            if (!works || !result)
            {
                return;
            }

            User user = UserController.GetUser(username);

            switch (user.Type)
            {
            case "Student":
            {
                StudentMenuWindow studentMenu = new StudentMenuWindow(user.User_ID);
                studentMenu.Show();
                Close();
                break;
            }

            case "Lecture":
            {
                LectureMenuWindow lectureMenu = new LectureMenuWindow(user.User_ID);
                lectureMenu.Show();
                Close();
                break;
            }

            default:
            {
                break;
            }
            }
        }