I want when closed app and reopen app save data in the app...
private void Button_Click(object sender, RoutedEventArgs e)
{
textblock.Visibility = Visibility.Visible;
}
I want add in this code save data in close the app?!
Is it Windows Phone 8.1 RT? If yes then you can do that:
var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
if (localSettings.Values.ContainsKey("textblockVisibility"))
{
var value = localSettings.Values["textblockVisibility"];
textblock.Visibility = (bool) value ? Visibility.Visible : Visibility.Collapsed;
}
else
{
var valueToSave = textBlock.Visibility == Visibility.Visible ? true : false;
localSettings.Values.Add("textblockVisibility", valueToSave);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.