Launching other applications in Windows phone 7 Pr

2020-02-06 10:05发布

问题:

I am downloading a file from Internet, and I am saving this in IsolatedStorage. and Now I want to Open that file, ie if it is excel we should open a file with excel if excel is installed, or otherwise prompt the user to choose the application to open that file as like in PC windows os, How can we do this.. give me some Idea..

回答1:

As general rule, there is no way to do what you are describing. The exception to this is for media, for which you can integrate with the Music and Video hub. This would allow you to, for instance, download a movie and then play it in the same way as if it was part of the zune collection, even though it's in IsolatedStorage.

If you want to download office files from the internet you can simply link to them directly by opening them in a WebBrowserTask. The user would then be able to open the file in the relevant office program. So, if you did the follwoing, the file would be opened in Excel:

var wbt = new WebBrowserTask();
wbt.URL = "http://example.com/file.xlsx";
wbt.Show();

This would not allow you to store the file in IsolatedStorage and that may or may not be an issue for you.



回答2:

Windows Phone applications run in isolation and with very few exceptions cannot interact with other programs. So there's not a way for you to present a program chooser to allow the user to choose another application to launch.



回答3:

I am pretty sure there are system launchers for different applications. For example, the YouTube application can be launched programatically the way I showed here - basically it is similar to the way Matt showed. Ultimately, each app is launched via a UIX reference (catched here), but there is no public endpoint to open a res URL.