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
  2. Getting reference to Button firing event.

Classes:

  1. Button is demonstrated.
  2. object sender is the button firing the event
  3. 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
  2. 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.
  2. 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.

  2. 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.
  2. Lifecycle methods of Application:
    1. OnStart - executes when programs starts - initialization here

    2. OnSleep - executes when program loses focus (I.e. is no longer in command of the screen) - cleanup and saving state here

    3. OnResume - executes when a program starts up again. - cleanup and re-establishing state here.

  3. 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
  2. Label is demonstrated again.

ManagingAndProgrammingMobileApplications/Xamarin/Chapter 6 (last edited 2016-09-07 21:34:50 by scot)