private void confirmLoginRegisterButton_Click(object sender, EventArgs e) { if (mode == Mode.LOGIN) { RequestLogIn?.Invoke(usernameExtendedTextBox.GetText(), passwordExtendedTextBox.GetText()); usernameExtendedTextBox.SetEmpty(); passwordExtendedTextBox.SetEmpty(); } else if (mode == Mode.REGISTER && usernameExtendedTextBox.ValidateAndGetResult() && passwordExtendedTextBox.ValidateAndGetResult() && firstNameExtendedTextBox.ValidateAndGetResult() && lastNameExtendedTextBox.ValidateAndGetResult() && emailExtendedTextBox.ValidateAndGetResult()) { RegisterRequest request = new RegisterRequest { Username = usernameExtendedTextBox.GetText(), Password = passwordExtendedTextBox.GetText(), FirstName = firstNameExtendedTextBox.GetText(), LastName = lastNameExtendedTextBox.GetText(), Email = emailExtendedTextBox.GetText() }; RequestRegister?.Invoke(request); usernameExtendedTextBox.SetEmpty(); passwordExtendedTextBox.SetEmpty(); firstNameExtendedTextBox.SetEmpty(); lastNameExtendedTextBox.SetEmpty(); emailExtendedTextBox.SetEmpty(); } else { MessageBox.Show("Wpisano niepoprawne dane", "Błąd", MessageBoxButtons.OK); } }
private void InitializeLoginForm() { loginForm = LoginForm.GetInstance(); loginForm.RequestRegister += (RegisterRequest request) => RequestRegister?.Invoke(request); loginForm.RequestLogIn += (string login, string password) => RequestLogIn?.Invoke(login, password); loginForm.FormClosing += (object sender, FormClosingEventArgs e) => activeForm = null; }
private void RegisterClicked(object sender, RoutedEventArgs e) { RequestRegister?.Invoke(this.usernameBox.Text, this.passwordBox.Password, this.passwordConfirmationBox.Password, this.emailBox.Text); }