HTML and CSS Reference
In-Depth Information
The method
pickSaveFileAsync
displays the user interface and returns only once the user has
dismissed the dialog or has selected a file. The method runs asynchronously; this means that you
need to use the
then
method to specify any behavior you want to run after the file has been selected.
The File save picker returns a
file.
parameter that refers to the name of the file being created.
If the file argument is
null
, then the user has dismissed the picker; otherwise, the user has successfully
selected a file. The next step of this exercise consists of displaying some properties of the file. In the
next chapter, you'll learn how to create and read files. Figure 9-5 shows the user interface of the file
picker about to create a new file in an empty folder.
FIGURE 9-5
The TodoList application ready to create a new file in the
Todo List
custom folder.
The object you receive from the file picker is a
StorageFile
object. To get its name, you can invoke
the
name
property. You can also invoke the
displayName
property if you want to get rid of the
associated extension. Figure 9-6 shows a message box with the name of the created file.
Search WWH ::
Custom Search