views:

77

answers:

2

Hi everyone. I'm building an application that displays a bunch of images (such as a slide-show), but I wan't the user to be able to chose this files, or folders. I have no idea how to make it (I've read something about IsolatedFileStorage, but didn't understand if this means I can't look into user files).

Edit: I found out a way to select image files from the user, which is simply calling the PhotoChoserTask Show() method, but it only displays the "My Images" folder from the device owner and allows to select a picture. This is not exactly what I want, since I want to be able to load an entire folder or even a picture container (such as a zip, I don't know). And even with this methods, I can't search a music file, for example.

Thanks in advance!

+2  A: 

You can only access files and images in this case outside of your application using the Photo Chooser task as you've been trying, it is not possible at this time to iterate though images that are in the Pictures Hub without it. However you can use the XNA MediaLibrary methods to iterate non-DRMed music and album art that is on the phone - but you can't see the files, there is no concept of a file system for your app other than isolated storage, so within your own apps sandbox you can itereate your own files anyway you want using IsolatedStorage techniques - but not outside the app.

RoguePlanetoid
+2  A: 

It will help if you provide a clearer definition of "user files". Are these file photos downloaded from the web, taken by the user using the CameraCaptureTask, selected by the user with the PhotoChooserTask, or shipped with your application? There are restrictions to programmatically access the pictures in the hub. As you have found, you can only access a certain folder.

You can always use isolated storage, build a directory structure, allow the user to choose a new directory (you can even allow tje user to pick a name for the new directory) and save the pictures from the chooser there, or. if the file has been downloaded from the web, save it to the newly created directory. Isolated storage allows you to list all directories and all files within all directories. Therefore, when the user wishes to open an item, you can present a list of directories, then a list of files in each directory (on a tap on the directory), tapping an item (a file) from the list will then open it.

Isolated storage can be used in several ways to design and build Windows Phone 7 application. Check out the Isolated Storage section in my list of Windows Phone 7 resources, I am sure you will find some useful posts/articles there.

EDIT: It seems you are looking at downloading media, storing them and playing them on demand. You will need to use WebClient or HttpWebRequest (Beware of cross-thread issues) to download the media and display/store. Here is a nice example by Tim Heuer that will point you to the right direction.

Hope this helps. indyfromoz

indyfromoz
Lets see if I understand: this Isolated Storage is not like a temporary folder, it still exists in the phone after the app is closed or the phone is shut down, am I right? Also, if I want to see user personal files (like those which are not images or something like that) I have to download them through the application, is that correct? And a final answer ... does this folder I created appear phisically to the user, so instead of him downloading a file through the app, he can possibly just drop the file in the folder (either by accessing his phone from his computer or through a file explorer)?
Bruno
yes, it still exists. Its called IsolatedStorage becasuse all of the data from one app is isolated from all other apps. To your application, isolated storage is the *only* files it can see. You cannot see this folder from the computer, there's no way for the user to put files in it *other than using your app on the phone*.
John Gardner
That means that the only way to get content is through a webservice? Or is there another way that doesn't involve downloading a 50 mb file in a mobile device?
Bruno
You can download a file using WebClient/HttpWebRequest to the phone, see my edited answer above. I think you should define your problem more clearly. If you were to play a 50mb video file, how else would you expect the file to be available on the phone, other than downloading over the internet?
indyfromoz