Game Development Reference
In-Depth Information
Figure 2.3
The complete user interface for the set-back thermostat.
19. With the new controls, our application needs to handle new events. Double-
click the TimeUpDown, AirRadio, and HeatRadio controls. Before each
double-click, you will have to switch to the Design view of House.vb. Visual
Studio will create the skeletons of the three event handlers we are interested
in. Double-clicking the control in the Design view is an alternative to using
the drop-down lists at the top of the Code view. Double-clicking takes
you to the most commonly used event; to get to other events, you will have
to use the drop-down menus.
20. Add the following familiar line of code to all three event handlers:
Call AI.RunAI(Me)
The code for House.vb should now look like the following:
'Here are the thermostat programmed values.
Public ReadOnly SetTemps() As Integer = {70, 64, 68, 60}
Public ReadOnly SetTimes() As Integer = {6, 9, 17, 21}
'We check the furnace at startup and whenever conditions change.
Private Sub House_Load(ByVal sender As Object, _
Search Nedrilad ::

Custom Search