0
votes

I'm developing a app where i have to display filenames in a listbox, files are created by the user and are stored in a directory created using isolated storage. i'm new to windows phone programming. i'm not finding enough resources for isolated storage file access??? Plzzz help

Code for Binding to the list:

private void bindList()
        {
           var  appStorage = IsolatedStorageFile.GetUserStoreForApplication();

            string[] fileList = appStorage.GetFileNames("/NotesForBible");

            listPicker1.ItemsSource = fileList;

       }

COde for adding the file:

{

var appStorage = IsolatedStorageFile.GetUserStoreForApplication(); appStorage.CreateDirectory("NotesForBible");

    if (!appStorage.FileExists(fileName))
    {
        using (var file = appStorage.CreateFile("NotesForBible/" + fileName ))
        {
            using (var writer = new StreamWriter(file))
            {
                writer.WriteLine(fileContent);
            }
        }
        }

I'm not able to view the files created in the listbox

1

1 Answers

0
votes
IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication();

To get an array of all filenames:

string directory = "whatever";
string[] filenames = store.GetFileNames(directory);

For further information: http://msdn.microsoft.com/en-us/library/system.io.isolatedstorage.isolatedstoragefile.aspx