コード例 #1
0
        private static void CreateAdminAndCheckLogin()
        {
            AdminLoginManager adminManager = new AdminLoginManager();

            if (!adminManager.IsAdminExist())
            {
                adminManager.CreateAdmin("admin123");
            }
            bool result = adminManager.Login("admin123");

            if (result == false)
            {
                throw new Exception("hiba??");
            }
        }
コード例 #2
0
        private void LoginButton_Click(object sender, RoutedEventArgs e)
        {
            string password = passwordBoxPassword.Password;

            if (manager.IsAdminExist() == false)
            {
                manager.CreateAdmin(passwordBoxPassword.Password);
                MessageBox.Show("Új adminisztrátor sikeresen regisztrálva!", "Admin regisztráció", MessageBoxButton.OK, MessageBoxImage.Information);

                Finished?.Invoke(this, OkCancelResult.Ok);
            }
            if (manager.Login(password))
            {
                Finished?.Invoke(this, OkCancelResult.Ok);
            }
            else
            {
                MessageBox.Show("Hibás jelszó", "Hiba", MessageBoxButton.OK, MessageBoxImage.Error);
                passwordBoxPassword.Clear();
            }
        }