23.01.2018 Views

MICROSOFT_PRESS_EBOOK_PROGRAMMING_WINDOWS_8_APPS_WITH_HTML_CSS_AND_JAVASCRIPT_PDF

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

FIGURE 12-16 The Save UI as displayed by the sample.<br />

FIGURE 12-17 Application UI settings in the manifest that affect the appearance of the open and save picker UI for a<br />

provider app. The gray bars in this image represent other fields that I’ve omitted for brevity.<br />

When you first run this sample, you won’t see either of these pages. Instead you’ll see a page<br />

through which you can invoke the file open or save pickers and then choose this app as a provider. You<br />

can do this if you like, but I recommend using a different app to invoke the pickers, just so we’re clear<br />

on which app is playing which role. For this purpose you can use the sample we used in Chapter 8, the<br />

File picker sample (this is the consumer side). You can even use something like the Windows 8 Music<br />

app where the Open File command on its app bar will invoke a picker wherein the provider sample will<br />

be listed.<br />

Whatever your choice, the important parts of the provider sample are its separate pages for servicing<br />

its contracts, which are again fileOpenPicker.html and fileSavePicker.html. In the first case, the code is<br />

contained in js/fileOpenPicker.js where we can see the activated event handler with the activation kind<br />

of fileOpenPicker:<br />

function activated(eventObject) {<br />

if (eventObject.detail.kind ===<br />

534

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!