コード例 #1
0
        public FormMain()
        {
            InitializeComponent();
            FakeAppUserRepository userDatabase = new FakeAppUserRepository();
            FormLogin             formLogin    = new FormLogin();
            AppUser user = new AppUser();

            formLogin.ShowDialog();
            while (!user.IsAuthenticated && formLogin.IsOpen)
            {
                formLogin.ShowDialog();
                user = formLogin.user;
            }
            if (!formLogin.IsAuthenticated)
            {
                Environment.Exit(0);
            }
        }
コード例 #2
0
        private void LoginBttn_Click(object sender, EventArgs e)
        {
            FakeAppUserRepository test = new FakeAppUserRepository();
            string user_name           = UserNameBox.Text;
            string password            = PasswordBox.Text;
            bool   result = test.Login(user_name, password);

            if (result == true)
            {
                test.SetAuthentication(user_name, result);
                LoginUser         = test.GetByUserName(user_name);
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                MessageBox.Show("Incorrect UsereName or Password. Try again!", "Attention");
            }
        }
コード例 #3
0
        private void loginButton_Click(object sender, EventArgs e)
        {
            FakeAppUserRepository test = new FakeAppUserRepository();
            string USER_NAME           = userNameInput.Text;
            string PASSWORD            = passwordInput.Text;
            bool   result = test.Login(USER_NAME, PASSWORD);

            if (result == true)
            {
                test.SetAuthentication(USER_NAME, result);
                LoginUser         = test.GetByUserName(USER_NAME);
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                MessageBox.Show("Incorrect UserName or Password.", "Attention");
            }
        }