Windows Phone, how to import data (IsolatedStorageFile)?

1

Is there any way I can import a data file (txt) into Windows Phone's internal memory using "IsolatedStorageFile"? I need to import a list of clients, and be able to edit by the device.

    
asked by anonymous 18.07.2014 / 14:28

1 answer

2

Isolated Storage is how we can record information from our Windows Phone applications on the device, without the need to use a SQL Server Compact database for this.

This saves a lot of time we would have to create a database structure and configure data access by our application but should not be used as a substitute for a database.

To use Isolated Storage you need to reference.

using System.IO.IsolatedStorage;

To store data from our application just use as in the code snippet below:

IsolatedStorage iso = IsolatedStorage.ApplicationSettings;
if(!iso.Contains("LISTA_CLIENTES"))
{
     iso.Add("LISTA_CLIENTES", new List<string>());
}

To retrieve information, just access the key that was created:

List<string> list = new List<string>();
if(iso.Contains("LISTA_CLIENTES"))
{
     list = iso["LISTA_CLIENTES"];
}

To write information to an existing key:

List<string> list = new List<string>();if(iso.Contains("LISTA_CLIENTES")){     iso["LISTA_CLIENTES"] = list;}

SOURCE

    
18.07.2014 / 14:34