Download
file type associations and autoplay n.
Skip this Video
Loading SlideShow in 5 Seconds..
File type associations and AutoPlay PowerPoint Presentation
Download Presentation
File type associations and AutoPlay

File type associations and AutoPlay

139 Vues Download Presentation
Télécharger la présentation

File type associations and AutoPlay

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. PLAT-282T File type associations and AutoPlay Anshul Rawat Principal Program Manager Lead Microsoft Corporation

  2. Agenda • Overview of file type / protocol association and AutoPlay • How your Metro style apps can participate You’ll leave with examples of how to • Participate in the file type / protocol association system • Participate in the AutoPlay system

  3. 5 things you need to know

  4. The Windows 8 file type, protocol and device association model puts the user in control while removing the burden from the app.

  5. demo File association and AutoPlay in action Choosing default handlers

  6. User experience model • The user is always in control • One common UI across Metro style apps and desktop apps • Consistent experience between file association and AutoPlay

  7. How do I get my app on the list?

  8. No installer code to write!

  9. demo Registering a Metro style app to handle file type / protocol associations & AutoPlay

  10. Registration via manifest • Declare your supported file types and/or protocols • Add AutoPlay Content or Device declarations to respond to device events • Remember: New scenarios (NFC) can take advantage of these registrations

  11. What should my app do when the user chooses it?

  12. Responding to activation events • File access is through the trust broker • Persist StorageFile items that you need to access across sessions • Responding to activation events from AutoPlay has been simplified for Metro style apps • AutoPlay will now call your app with your verb and the root folder of the device content

  13. Receiving a StorageFile Item • // Receive activation. • function onActivatedHandler(eventArgs) { • if (eventArgs.kind == Windows.ApplicationModel.Activation.ActivationKind.file) { • … • sdkSample.displayStatus("File activation received. The number of files received is " + eventArgs.files.size + ". The first received file is " + eventArgs.files[0].name + ".");

  14. Persisting access to a StorageFile item StorageApplicationPermissions.mostRecentlyUsedList.add • // From FileAccess SDK sample • function scenario5AddToMRU() { • //Adding sample.txt in the MRU list • if(sampleFile != null) { • mruToken = Windows.Storage.AccessCache.StorageApplicationPermissions.mostRecentlyUsedList.add(sampleFile, sampleFile.fileName); • id("scenario5Output").innerHTML = '<p>The file <b>sample.txt</b> was added into MRU list and a token was stored.</p>'; • } • }

  15. Receiving Items from AutoPlay • // Receive activation. • function onActivatedHandler(eventArgs) { • if (eventArgs.kind == Windows.ApplicationModel.Activation.ActivationKind.file) { • … • sdkSample.displayStatus("AutoPlay content received. The user selected the " + eventArgs.verb+ " task. The folder containing the items is " + eventArgs.files[0].name + ".");

  16. How can I launch other files or protocols from my app?

  17. demo Launcher API, SDK sample

  18. New launcher APIs • Basic usage – launch a file • Windows.System.Launcher.launchDefaultProgramForFile(file); • Basic usage – launch a protocol • Windows.System.Launcher.launchDefaultProgram(uri); • Force OpenWith to appear (for use in a secondary action) • Windows.System.Launcher.launchDefaultProgramForFile(file, Windows.System.ProgramPickerOptions.none, anchor);

  19. How should my app manage defaults for file types and protocols?

  20. Guidelines for existing apps • You don’t need to check to see if your app is the default • You don’t need to set your app as the default • You don’t need to manage defaults for file types and protocols from within your app • You could integrate with the control panel instead

  21. Recap

  22. Recap • How to get your app in the Open With & AutoPlay UI • How to respond to activation in your apps • How to launch other files and protocols • What the model means for existing apps

  23. Related sessions • PLAT-894T: Seamlessly interacting with web and local data • PLAT-891T: Using files: accessing, searching, and acting on files • HW-269T: Designing systems and developing drivers for NFC

  24. Further reading and documentation • Association Launching SDK sample • FileAccess SDK sample • Whitepaper for implementing file type / protocol associations • Whitepapers for implementing AutoPlay (JS, C#/VB/C++) • Questions? • Please visit the forums on the Windows Dev Center at http://forums.dev.windows.com • For best response, please include the Build Session # in the title of your post

  25. thank you Feedback and questions http://forums.dev.windows.com Session feedbackhttp://bldw.in/SessionFeedback

  26. © 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.