-
Notifications
You must be signed in to change notification settings - Fork 1
/
LoginForm.vb
36 lines (31 loc) · 1.09 KB
/
LoginForm.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Imports ValidatorLibrary.Classes
Imports ValidatorLibrary.LanguageExtensions
Imports ValidatorLibrary.Validators
''' <summary>
''' Very simple demo for using validation
''' </summary>
Public Class LoginForm
Private retryCount As Integer = 0
Private Sub LogInButton_Click(sender As Object, e As EventArgs) _
Handles LogInButton.Click
Dim login As New CustomerLogin With
{
.Name = UserNameTextBox.Text,
.Password = PasswordTextBox.Text,
.PasswordConfirmation = PasswordConfirmTextBox.Text
}
Dim validationResult As EntityValidationResult = ValidationHelper.ValidateEntity(login)
If validationResult.HasError Then
If retryCount >= 3 Then
MessageBox.Show("Guards toss them out!")
Close()
End If
MessageBox.Show(validationResult.ErrorMessageList())
retryCount += 1
Else
Dim f As New MainForm(login.Name)
f.Show()
Hide()
End If
End Sub
End Class