-
Notifications
You must be signed in to change notification settings - Fork 0
/
VibeRegister.vb
121 lines (90 loc) · 4 KB
/
VibeRegister.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
''' <summary>The ViBE Registration Window</summary>
Public Class VibeRegister
'--------------------------------[Variables]--------------------------------
Public ServerMSG As String
'--------------------------------[Initialization]--------------------------------
''' <summary>Sets the form up to be presented</summary>
Private Sub Boing() Handles Me.Load
'These should be the default values, but I have to set them here since I like seeing them while designing.
TC1.Visible = True
TC2.Visible = True
CheckBox1.Visible = True
IDLabel.Visible = True
PinLabel.Visible = True
NameTXB.Visible = True
PINTXB.Visible = True
CongratsLBL1.Visible = False
CongratsLBL2.Visible = False
CongratsLBL3.Visible = False
CongratsLBL4.Visible = False
CongratsIDLBL.Visible = False
OKBTN.Visible = False
Size = New Size(382, 454)
End Sub
'--------------------------------[Buttons]--------------------------------
Private Sub ClosingTime() Handles CancelButtonReg.Click, OKBTN.Click
Close()
End Sub
Private Sub PreRegisterTime() Handles RegisterButton.Click
If Not CheckForInput() Then
MsgBox("Please specify appropriate inputs", MsgBoxStyle.Exclamation, "Registration Error")
Exit Sub
End If
If CheckBox1.Checked = False Then
MsgBox("Please accept the terms and conditions.", MsgBoxStyle.Exclamation, "Registration Errror")
Exit Sub
End If
RefreshNotice.Show()
BackgroundWorker1.RunWorkerAsync()
End Sub
''' <summary>Shows a warning to people attempting to start a corporate UMSWEB account</summary>
Private Sub ShowCorporateWarning() Handles CheckBox2.CheckedChanged
If CheckBox2.Checked Then
MsgBox("WARNING: If this is later found out this isn't actually used for corporate dealings, you will be liable for FRAUD and you will be charged backtaxes for any income registered to this account. By ticking this box you acknowledge that you have been notified about this.", MsgBoxStyle.Exclamation, "Warning!")
End If
End Sub
'--------------------------------[Background Workers]--------------------------------
''' <summary>Asks server to register the user</summary>
Private Sub RegisterTime() Handles BackgroundWorker1.DoWork
ServerMSG = RegisterUser(PINTXB.Text, NameTXB.Text, CheckBox2.Checked)
End Sub
''' <summary>Parses the response, and displays the post-registratoin message</summary>
Private Sub PostRegisterTime() Handles BackgroundWorker1.RunWorkerCompleted
If ServerMSG = "E" Then
MsgBox("The server couldn't register you. Please try again later.")
Exit Sub
End If
'Sets things to be visible
TC1.Visible = False
TC2.Visible = False
CheckBox1.Visible = False
IDLabel.Visible = False
PinLabel.Visible = False
NameTXB.Visible = False
PINTXB.Visible = False
CongratsLBL1.Visible = True
CongratsLBL2.Visible = True
CongratsLBL3.Visible = True
CongratsLBL4.Visible = True
CongratsIDLBL.Visible = True
CongratsIDLBL.Text = ServerMSG
OKBTN.Visible = True
CongratsLBL4.Text = "Welcome to the UMSWEB, " & NameTXB.Text & "!"
Size = New Size(382, 354)
RefreshNotice.Close()
End Sub
'--------------------------------[Other Functions]--------------------------------
''' <summary>Check user's inputted data</summary>
''' <returns>True if its acceptable, False if otherwise</returns>
Private Function CheckForInput() As Boolean
'Name checks
If String.IsNullOrWhiteSpace(NameTXB.Text) Then
Return False
End If
'Pin Checks
If String.IsNullOrWhiteSpace(PINTXB.Text) Or Not PINTXB.Text.Count = 4 Then
CheckForInput = False
End If
Return True
End Function
End Class