In winrt development, you can call other applications or desktop programs to open files. This is more functional than several launcher in the WP7 era.
The code is simple and clear:
Public void openfile (storagefile file, bool withpicker) {If (file! = NULL) {If (withpicker) {// select the open mode var Options = new launcheroptions {displayapplicationpicker = true}; options. UI. preferredplacement = placement. below; launcher. launchfileasync (file, options);} else {// use the default associated program to open launcher. launchfileasync (File );}}}
Introduce the namespace using Windows. System to launcher;
Launcheroptions has the following attributes:
Contenttype: sets the file type for URLs on the network;
Displayapplicationpicker: whether to display the list of enabled methods;
Fallbackuri: when there is no corresponding opening method and no file type or Protocol application is processed, the user should jump to the URI value of the browser;
Preferredapplicationdisplayname:There is no corresponding opening method, and no application processing the file type or protocol, the name of the application installed by the user is displayed in the storage area;
Preferredapplicationpackagefamilyname:If no application processes the file type or protocol, the package series of the application you have installed in the storage area displays the value of the name;
Treatasuntrusted: whether to display a warning message to the user, so that the user can confirm to open it again;
Ui: the default Interface option when the application is started;
Note that the winrt app file system is not a traditional desktop file system (although it is a folder in a traditional desktop file system, but due to permission issues, it can be understood as an independent bucket similar to WP7). When we open a file in this way and modify the file with a third-party program, the modification will not perform any operations on the original file.
Jin YanyunMicro Blog http://www.weibo.com/jinyanyunHttp://www.cnblogs.com/vistach/archive/2012/10/18/Windows8_Win8_WinRT_MetroStyleApps_ModernUIApps_Launcher_LauncherOptions_OpenFile.html