private static void Screen_Login(object sender, LoginEventArgs e) { System.Threading.Thread.Sleep(2000); e.Success = (e.Username == "admin" & e.Password == "admin"); if (!e.Success) e.FailureMessage = "Take the hint."; }
private void DoLogin() { if (!string.IsNullOrWhiteSpace(usernameTextBox.Text)) { Console.CursorVisible = false; progressBar.Visible = true; var args = new LoginEventArgs(Username, Password); OnLogin(args); progressBar.Visible = false; if (args.Success) return; failureLabel.Visible = true; failureLabel.Text = args.FailureMessage; } Password = string.Empty; Draw(); Paint(); passwordTextBox.Focus(); }
protected virtual void OnLogin(LoginEventArgs args) { if (Login != null) Login(this, args); }