示例#1
0
        private async void btnLogin_Click(object sender, EventArgs e)
        {
            panel3.Visible = false;
            List <string> lstInput = new List <string> {
                txtUsername.Text, txtPassword.Text
            };

            if (Helper.ValidateTextFields(lstInput))
            {
                LogInService _service = new LogInService();
                var          user     = await _service.GetUserLoggedIn(txtUsername.Text, txtPassword.Text);

                if (user != null)
                {
                    MessageBox.Show("Logged in.");
                }
                else
                {
                    txtPassword.Text = "";
                    lblError.Text    = "Invalid Username or Password";
                    panel3.Visible   = true;
                }
            }
            else
            {
                lblError.Text  = "Username and password are required";
                panel3.Visible = true;
            }
        }