File type associations and AutoPlay 1/1/2019 6:25 PM PLAT-282T File type associations and AutoPlay Anshul Rawat Principal Program Manager Lead Microsoft Corporation © 2010 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.
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
5 things you need to know User Experience Registration Activation Launching Managing
The Windows 8 file type, protocol and device association model puts the user in control while removing the burden from the app.
File association and AutoPlay in action 1/1/2019 6:25 PM demo File association and AutoPlay in action Choosing default handlers © 2010 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.
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
How do I get my app on the list? User Experience Registration Activation Launching Managing How do I get my app on the list?
No installer code to write!
1/1/2019 6:25 PM demo Registering a Metro style app to handle file type / protocol associations & AutoPlay © 2010 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.
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
What should my app do when the user chooses it? User Experience Registration Activation Launching Managing What should my app do when the user chooses it?
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
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 + "."); © 2010 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.
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>'; } © 2010 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.
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 + "."); © 2010 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.
How can I launch other files or protocols from my app? User Experience Registration Activation Launching Managing How can I launch other files or protocols from my app?
Launcher API, SDK sample 1/1/2019 6:25 PM demo Launcher API, SDK sample © 2010 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.
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); © 2010 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.
How should my app manage defaults for file types and protocols? User Experience Registration Activation Launching Managing How should my app manage defaults for file types and protocols?
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
Recap
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
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
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
thank you Feedback and questions http://forums.dev.windows.com Session feedback http://bldw.in/SessionFeedback
1/1/2019 6:25 PM © 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. © 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.