HTML and CSS Reference
In-Depth Information
Figure 9-4 shows the new look and feel of the summary displayed to the user when the task is
ready for storing.
FIGURE 9-4 The summary flyout as modified in this chapter.
Unsnap before you pick
Once the user clicks the button in Figure 9-4, the application should let her pick up a file where
the task will be saved. This entails consuming the File picker contract as it is implemented by the
operating system. Windows 8 provides its own version of the dialog box shown in Figure 9-3. The
Windows Store counterpart of the familiar file Open/Save dialog box is just a component that exposes
the File picker contract.
At this stage, you don't need yet to get acquainted with the nitty-gritty details of contracts, as
the details of the File picker contract are buried in the folds of a few new high-level components and
functions. These components and functions are the only ones you need to get familiar with.
A key rule you need to cope with is that a Windows Store application is not allowed to invoke a
file picker if it is in a snapped state. Because of this, you should add the following code at the very
beginning of the TodoList.pickFileAndSaveTask function in the todolist.js ile.
var currentState = Windows.UI.ViewManagement.ApplicationView.value;
if (currentState === Windows.UI.ViewManagement.ApplicationViewState.snapped &&
!Windows.UI.ViewManagement.ApplicationView.tryUnsnap()) {
// Fail silently if you can't unsnap the app
Search WWH ::

Custom Search