Question

I want to make a simple note taking app for Windows Phone 8.

My question is: How do I make the text that the user puts into the textbox stay inside the textbox even if the app is suspended or deactivated?

Help is appreciated.

Était-ce utile?

La solution

try using IsolatedStorage for saving your user's notes inside phone's memory and try getting them back when your app is launched again. Here is a link that will help you get through IsolatedStorage MSDN Link Another Project

Example code from the second link:

Storing:

private void Button_Click_2(object sender, RoutedEventArgs e)
{
    IsolatedStorageSettings isoStoreSettings = IsolatedStorageSettings.ApplicationSettings;
    int integerValue;
    int.TryParse(Entier.Text, out integerValue);
    //store the integer
    isoStoreSettings["IntegerValue"] = integerValue;
    //store the string
    isoStoreSettings["StringValue"] = chaine.Text;
}

Retrieving:

private void Button_Click_1(object sender, RoutedEventArgs e)
{
    IsolatedStorageSettings isoStoreSettings = IsolatedStorageSettings.ApplicationSettings;
    int integerValue;
    string stringValue;

    //Retreive The integer
    if (isoStoreSettings.TryGetValue("IntegerValue", out integerValue))
    {
        Entier.Text = integerValue.ToString();
    }

    //Retreive the string
    if (isoStoreSettings.TryGetValue("StringValue", out stringValue))
    {
        chaine.Text = stringValue;
    }
    isoStoreSettings.Save();
} 
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top