private void LoginButton_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(UserTextBox.Text)) { MessageBox.Show("Enter the user name!"); } else if (string.IsNullOrEmpty(PasswordTextBox.Text)) { MessageBox.Show("Enter the Password!"); } else if (UserTextBox.Text == ("guest") && PasswordTextBox.Text == ("£123")) { films.Enabled = true; LoginButton.Hide(); LogoutButton.Show(); UserTextBox.Enabled = false; PasswordTextBox.Enabled = false; } else if ((UserTextBox.Text == ("Mike")) || (UserTextBox.Text == ("Jon")) && PasswordTextBox.Text == ("£456")) { films.Enabled = true; staff.Enabled = true; LoginButton.Hide(); LogoutButton.Show(); UserTextBox.Enabled = false; PasswordTextBox.Enabled = false; pictureStaff.Hide(); } else { WrongText.Text = "Wrong credentials"; UserTextBox.Text = string.Empty; PasswordTextBox.Text = string.Empty; } }
private void LoginButton_Click(object sender, EventArgs e) { string user = UsernameTextBox.Text; string pass = PasswordTextBox.Text; if (newlogin.Verify(user, pass)) { //login to dashboard if (newlogin.IspwdReset()) { //show new/confirm password textboxes and update password PasswordLabel.Hide(); NewPasswordLabel.Show(); ConfirmPasswordLabel.Show(); ConfirmPasswordTextBox.Show(); PasswordTextBox.Text = ""; MessageBox.Show("Please update your password."); LoginButton.Hide(); ConfirmLoginButton.Show(); } else { //MessageBox.Show("Login successfull!"); this.Hide(); Dashboard db = new Dashboard(newlogin.GetUserID()); db.Show(); } } }
private void HideLoginComp() { EmailTextB.Hide(); PassTextB.Hide(); LoginButton.Hide(); EmailLabel.Hide(); PassLabel.Hide(); }
private void loginButton_Click(object sender, EventArgs e) { if (m_FacebookUserInfo.User == null) { m_UserLogin.LoginAsync(); } LoginButton.Hide(); }
public void UpdateLoginBox() { if (Model.Session == null) { LoginBox.Text = "Not logged in yet."; } else { LoginBox.Text = $"Logged in as: {Model.Session.Account.Username}"; LoginButton.Hide(); } }
private void setState(FormState state) { switch (state) { case FormState.Check: CheckServer(); break; case FormState.Login: LoginButton.Enabled = true; break; case FormState.ExamLoading: LoadResource <Exam>("exams", FormState.QuestionLoading, arr => { Exams = arr; ExamListView.Items.Clear(); ShowExams(); }); LoginButton.Hide(); break; case FormState.QuestionLoading: LoadResource <Question>("questions", FormState.ResoultsLoding, arr => { Questions = arr; FillExamsWithQuestions(); Exam[] e = Exams; ExamStartButton.Enabled = true; }); ExamStartButton.Show(); ExamStartButton.Enabled = false; break; case FormState.ResoultsLoding: LoadResource <Resoult>("resoults", FormState.LoggedIn, arr => { Resoults = arr; if (ExamListView.Items.Count > 0) { ExamListView.SelectedIndex = 0; } else { ExamStartButton.Enabled = ExamStatisticButton.Enabled = false; } }); break; case FormState.LoggedIn: examButtons.ForEach(u => u.Show()); break; } }
} // end of sendButton /*************************** Login Button ************************************* * Takes the users name they typed in the username textbox and requests a connction * with the server, then logs in to the server enabling the create button, list * games button, and join button. */ private void LoginButton_Click_1(object sender, EventArgs e) { // handle a blank username and don't allow people to have names longer than 16 characters if (textBox3.Text.Trim() == "") { textBox1.Text = "Please enter a Username before logging in"; return; } if (textBox3.Text.Length > 16) { textBox1.Text = "You shall not enter names longer than 16 characters!"; return; } // Username is what was typed into the textbox clientNo = textBox3.Text; try { // Try to connect to the server clientSocket.Connect("18.216.181.228", 13000); // *** Loopback can be uncommented out for testing on local machine *** // just make sure you comment out the IP above //clientSocket.Connect("127.0.0.1", 13000); serverStream = clientSocket.GetStream(); // Send the user name to the server byte[] outStream = System.Text.Encoding.ASCII.GetBytes(textBox3.Text + "|"); serverStream.Write(outStream, 0, outStream.Length); serverStream.Flush(); // Create a new thread top handle the client Thread ctThread = new Thread(getMessage); ctThread.Start(); } catch (Exception ex) { textBox1.AppendText(ex.ToString()); } if (clientSocket.Connected) { // If the client connects successfully, enables button functions LoginButton.Hide(); CreateButton.Show(); ListGamesButton.Show(); JoinButton.Show(); SendButton.Show(); } } // end of LoginButton