Пример #1
0
        /**
         * Login Method to handle Login Button
         * @param  object sender
         * @param  RoutedEventArgs e
         */
        private void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            ApiOperations ops      = new ApiOperations();
            string        username = tbxUsername.Text;
            string        password = pbxPassword.Password;


            // Kan slettes, bruges blot til test
            if (ops.CheckIfAdmin(username, password))
            {
                ShowMainMenu();
                return;
            }
            //NavigationService.Navigate(new MainWindow());

            User user = ops.AuthenticateUser(username, password);

            if (user == null)
            {
                MessageBox.Show("Invalid username or password");
                return;
            }

            Globals.LoggedInUser = user;
            // MessageBox.Show("Login successful");
            ShowMainMenu();
            //NavigationService.Navigate(new DetailsPage());

            //her indsættes kode til at åbne MainWindow
        }
Пример #2
0
 public void Api_CheckAdmin_AdminIsFalse()
 {
     Assert.That(_uut.CheckIfAdmin("Ad", "Ad"), Is.EqualTo(false));
 }