Private Sub frmScience2_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
lblClose.ImageIndex = 3
lblMinimize.ImageIndex = 0
End Sub
Private Sub frmScience2_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Activated
' Starts the timer and animates Merlin.
With Agent
.Play("Wave")
.Speak(UserName & ", now you will have to listen and spell the key word.")
End With
tmrToGo.Enabled = True
tmrToGo.Start()
End Sub
Private Sub tmrToGo_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrToGo.Tick
Static Counter As Integer = 0
If Counter = 0 Then
Counter = Counter + 1
ElseIf Counter = 1 Then
lblToGo.Text = "READY..."
Counter = Counter + 1
ElseIf Counter = 2 Then
lblToGo.Text = "...SET..."
Counter = Counter + 1
ElseIf Counter = 3 Then
lblToGo.Text = "...GO!"
Counter = Counter + 1
ElseIf Counter = 4 Then
lblToGo.Text = "LISTEN AND SPELL"
' Enable the first question
grpSound1.Enabled = True
' Play the first sound.
Sound.PlayWavResource("mysterious.wav")
' stop the timer so it does not repeat itself.
tmrToGo.Stop()
tmrToGo.Enabled = False
tmrToGo.Dispose()
End If
End Sub
'---------------------------------------------------------------------
Public Sub AgentMessage()
' Shows user-friendly message which says that they may only play
' the sound once extra.
With Agent
.Play("Decline")
.Play("Explain")
.Speak("I will only let you repeat the sound once " & UserName & ".")
.Play("Pleased")
End With
End Sub
Private Sub btnPlaySound1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPlaySound1.Click
Sound.PlayWavResource("mysterious.wav")
' the user is only allowed to listen to the sound twice.
btnPlaySound1.Enabled = False
AgentMessage() 'Calls subroutine AgentMessage
End Sub
Private Sub btnPlaySound2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPlaySound2.Click
Sound.PlayWavResource("consistant.wav")
btnPlaySound2.Enabled = False
AgentMessage()
End Sub
Private Sub btnPlaySound3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPlaySound3.Click
Sound.PlayWavResource("fracture.wav")
btnPlaySound3.Enabled = False
AgentMessage()
End Sub
Private Sub btnPlaySound4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPlaySound4.Click
Sound.PlayWavResource("personality.wav")
btnPlaySound4.Enabled = False
AgentMessage()
End Sub
Private Sub btnPlaySound5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPlaySound5.Click
Sound.PlayWavResource("inadequate.wav")
btnPlaySound5.Enabled = False
AgentMessage()
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
Quit()
End Sub
Private Sub btnMain_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMain.Click
With Agent
.Speak("Lets go find another topic, shall we, " & UserName & "?")
.Play("DoMagic1")
End With
' Get rid of any stored scores if the user went from Spelling1 to here
' and went to main.
ClearVarSpelling()
Threading.Thread.Sleep(8000)
MainForm.Show()
Me.Close()
End Sub
Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
' Checks the answers and add to points
ValidateAnswers()
' Globally denotes that maths has been completed.
SpellingDone = True
' Finishes any queued processes
Application.DoEvents()
With Agent
.Play("DoMagic1")
End With
' the thread sleeps for 2.5 seconds for Merlin
Threading.Thread.Sleep(2500)
' Shows the main form
MainForm.Show()
Me.Close()
End Sub
'---
Private Sub btnLockIn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLockIn1.Click
grpSound1.Enabled = False
grpSound2.Enabled = True
Sound.PlayWavResource("consistant.wav")
' Compares string to string in uppercase and changes textbox
' back colour accordingly. Red = wrong, blue = right.
If txtKeyWord1.Text.ToUpper.Equals("MYSTERIOUS") Then
txtKeyWord1.BackColor = Color.FromArgb(192, 192, 255)
Else : txtKeyWord1.BackColor = Color.FromArgb(255, 192, 192)
End If
End Sub
Private Sub btnLockIn2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLockIn2.Click
grpSound2.Enabled = False
grpSound3.Enabled = True
Sound.PlayWavResource("fracture.wav")
If txtKeyWord2.Text.ToUpper.Equals("CONSISTANT") Then
txtKeyWord2.BackColor = Color.FromArgb(192, 192, 255)
Else : txtKeyWord2.BackColor = Color.FromArgb(255, 192, 192)
End If
End Sub
Private Sub btnLockIn3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLockIn3.Click
grpSound3.Enabled = False
grpSound4.Enabled = True
Sound.PlayWavResource("personality.wav")
If txtKeyWord3.Text.ToUpper.Equals("FRACTURE") Then
txtKeyWord3.BackColor = Color.FromArgb(192, 192, 255)
Else : txtKeyWord3.BackColor = Color.FromArgb(255, 192, 192)
End If
End Sub
Private Sub btnLockIn4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLockIn4.Click
grpSound4.Enabled = False
grpSound5.Enabled = True
Sound.PlayWavResource("inadequate.wav")
If txtKeyWord4.Text.ToUpper.Equals("PERSONALITY") Then
txtKeyWord4.BackColor = Color.FromArgb(192, 192, 255)
Else : txtKeyWord4.BackColor = Color.FromArgb(255, 192, 192)
End If
End Sub
Private Sub btnLockIn5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLockIn5.Click
grpSound5.Enabled = False
btnNext.Enabled = True
If txtKeyWord5.Text.ToUpper.Equals("INADEQUATE") Then
txtKeyWord5.BackColor = Color.FromArgb(192, 192, 255)
Else : txtKeyWord5.BackColor = Color.FromArgb(255, 192, 192)
End If
End Sub