= Chapter 6 Notes =

Title: '''Buttons Clicks'''

== Summary ==

So much ado about Buttons and the way to handle clicks. And as a bonus, we'll throw in persistence in values. 

== Programs ==

=== ButtonLogger ===

Page 113-114

Concepts:

 1. Handling Button Click Events
 1. Getting reference to Button firing event. 

Classes: 

 1. Button is demonstrated.
 1. object sender is the button firing the event
 1. EventArgs class contains generic event args that in this case contain nothing. 



=== TwoButtons ===

Page 117-118

Concepts:

 1. Using the sender to identify what button is invoking the event handler
 1. Shows how to enable and disable a button. 

Classes: 

 1. Button is demonstrated again. 


=== ButtonLambdas ===

Page 120 

Concepts:

 1. Anonymous event handlers a.k.a Lambda expresions. 
 1. When using Device.GetNamedSize(NamedSize.Large, '''typeof(Label|Button)''') as appropriate. 

Classes: 

 1. Button is demonstrated again.


=== SimpleKeypad ===

Page 122-123

Concepts:

 1. Distinguishing views with {{{StyleId}}} property in a hander that is invoked by multiple buttons. 
 1. Includes concept of enabling and disabling button as appropriate.

Classes: 

 1. Label is demonstrated again.


=== PersistentKeypad ===

Page 128-129

Concepts:

 1. Persisting data from one run of the program to another. 
 1. Lifecycle methods of Application:
    1. OnStart - executes when programs starts - initialization here
    1. OnSleep - executes when program loses focus (I.e. is no longer in command of the screen) - cleanup and saving state here
    1. OnResume - executes when a program starts up again. - cleanup and re-establishing state here. 
 1. Debugging: '''OnSleep''' is activated using the respective methods to invoke the application switcher (iOS: double tap home, android: switcher button or hold home key, windows: hold back key) and '''OnResume''' by selecting the application. 


Classes: 

 1. Properties[] demonstrated in App.cs
 1. Label is demonstrated again.