101 Windows Phone 7 Apps: In Case of Emergency
The "In Case of Emergency" app is meant to help save your life in the event you become a victim of a serious accident. The idea is that if someone finds you in a state in which you are unable to communicate, that person might check your phone for important information about yourself. (Hopefully this is done after calling 911!) If this person launches the "In Case of Emergency" app, they will see an emergency contact whom he/she can call, as well as any important medical information that the paramedics should know.
To help this Good Samaritan stumble upon your "In Case of Emergency" app, its app icon and tile icon are bright red, as shown in Figure 3.1. Basically, this app is for super-prepared people who don't password-protect their phones! As ridiculous as this might sound, there is a market for this type of app.
Figure 3.1 The tile for "In Case of Emergency" clearly stands out (unless the user's theme accent color is red).
Although the "In Case of Emergency" title fits (barely) in the app list, it does not fit on the tile. Therefore, this app modifies the default token title in the application manifest (as described in Chapter 1, "Tally") to simply "ICE," a somewhat-common abbreviation for "In Case of Emergency." (Some people store a contact on their phone named "ICE," in case their rescuer is familiar with this convention.)
This is the first app that must do work to support multiple orientations and the first app that involves typing, so before creating it we will explore the following three topics:
- Orientation
- The On-Screen Keyboard
- The Hardware Keyboard
Orientation
As shown in the preceding chapter, Windows phones support three orientations:
- Portrait (vertical, with the screen above the hardware buttons)
- Landscape Left (horizontal, with the screen to the left of the hardware buttons)
- Landscape Right (horizontal, with the screen to the right of the hardware buttons)
To support orientations other than portrait, you can change the value of a page's SupportedOrientations property to Landscape to only support the two landscape orientations, or to PortraitOrLandscape to support all three. You cannot choose to support only one of the landscape orientations; if your app works with one of the landscape orientations then it must work for both of them. Therefore, do not assume which side of the screen the application bar resides for a landscape page. As seen in the preceding chapter, it can appear on either the left or right side.
When you set SupportedOrientations to PortraitOrLandscape, the page automatically rotates to the proper orientation at the appropriate times (based on the angle the user holds their phone and whether a hardware keyboard is activated). This rotation is instant; your content is not animated. System-provided components, such as the status bar, application bar, message boxes and other notifications, adjust automatically as well, but with animations.
If you wish to perform a custom action when the orientation changes, such as a full-screen animation or custom rearranging of elements, you can leverage a page's OrientationChanged event.