23.01.2018 Views

MICROSOFT_PRESS_EBOOK_PROGRAMMING_WINDOWS_8_APPS_WITH_HTML_CSS_AND_JAVASCRIPT_PDF

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Do note that as with file picker providers, a contact provider needs to be ready to save its session<br />

state when suspended such that it can restore that state when relaunched with<br />

previousExecution-State set to terminated. Although not demonstrated in the sample, a real provider<br />

app should save its current selections and viewing position within its list, along with whatever else, to<br />

session state and restore that in its activated handler when necessary.<br />

What We’ve Just Learned<br />

• Contracts in Windows 8 provide the ability for any number of apps to extend system<br />

functionality as well as extend the functionality of other apps. Through contracts, installing more<br />

apps that support them creates a richer overall environment for users.<br />

• The Share contract provides a shortcut means through which data from one app can be sent to<br />

another, eliminating many intermediate steps and keeping the user in the context of the same<br />

app. A source app packages data it can share when the Share charm is invoked; target apps<br />

consume that data, often copying it elsewhere as in an email message, text message, social<br />

networking service, and so forth.<br />

• The Share target provides for delayed rendering of items (such as graphics), for long-running<br />

operations (such as when it’s necessary to upload large data files to a service), and for providing<br />

quicklinks to specific targets within the same app (such as frequent email recipients).<br />

• The Search contract provides integration between an app and the Search charm. From the<br />

charm users can search the current app as well as any others that support the contract, easily<br />

viewing results from other apps without having to manually launch them or switch to them. The<br />

search contract allows apps to also provide query suggestions and result suggestions.<br />

• File type and URI scheme associations are how apps can launch other apps. an app’s<br />

associa-tions are declared in its manifest allowing it to be launched to service those associations.<br />

URI scheme associations are an excellent means for an app to provide workflow services to<br />

others.<br />

• Apps that implement the provider side of the file picker contract appear as choices within the file<br />

picker UI. This is how apps can present data sources they manage as if they were part of the local<br />

file system, even though they might exist in databases, online services, or other such locations.<br />

To the user, the necessary transport considerations are transparent, and through the cached file<br />

updater contract a provider app can also handle synchronization of local and remote copies of<br />

the file.<br />

• The contract for Contacts works similarly to the file picker but with information about people. A<br />

consuming app can easily invoke the contact picker UI and any number of provider apps can<br />

implement the other side of the contract to surface an address book, database, or other source<br />

through that UI.<br />

556

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

Saved successfully!

Ooh no, something went wrong!