HTML and CSS Reference
In-Depth Information
Making Task objects persistent
You make a copy of the TodoList project as you left it at the end of Chapter 9, “Integrating with the
Windows 8 environment”; name this new project TodoList-Persistence . To avoid confusion, you
might also want to open default.html and edit the title of the application. In the BODY element of the
page, replace the H1 element as shown below:
<h1>TO-DO List (CH10)</h1>
The application currently lets you pick a file name from a folder on the local disk and returns you
an object that represents the file you'd like to have. This file, however, doesn't exist yet; so the next
step is creating a real file and storing some real data to it. For this to happen, you must be familiar
with the Input/Output (I/O) objects of Windows 8.
The add-task use case
In Chapter 9, you learned how to invoke the File Save Picker component to pick up a file name from a
disk folder. Figure 10-1 briefly recalls the steps of the add-task workflow.
FIGURE 10-1 The add-task workflow.
First the user clicks the Add Task button; next she is presented a summary of the current task,
and if everything is OK then she proceeds to save the task to disk. The application pops up a file
picker and she selects a folder and enters a file name. In Chapter 9, you had the following code in the
TodoList.invokeSavePicker method within the todolist.js file:
savePicker.pickSaveFileAsync().then(function (file) {
if (file) {
Search WWH ::

Custom Search