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:
- Handling Button Click Events
- Getting reference to Button firing event.
Classes:
- Button is demonstrated.
- object sender is the button firing the event
EventArgs class contains generic event args that in this case contain nothing.
TwoButtons
Page 117-118
Concepts:
- Using the sender to identify what button is invoking the event handler
- Shows how to enable and disable a button.
Classes:
- Button is demonstrated again.
ButtonLambdas
Page 120
Concepts:
- Anonymous event handlers a.k.a Lambda expresions.
When using Device.GetNamedSize(NamedSize.Large, typeof(Label|Button)) as appropriate.
Classes:
- Button is demonstrated again.
SimpleKeypad
Page 122-123
Concepts:
Distinguishing views with StyleId property in a hander that is invoked by multiple buttons.
- Includes concept of enabling and disabling button as appropriate.
Classes:
- Label is demonstrated again.
PersistentKeypad
Page 128-129
Concepts:
- Persisting data from one run of the program to another.
- Lifecycle methods of Application:
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:
- Properties[] demonstrated in App.cs
- Label is demonstrated again.