我在商店里有一个Windows Phone 8.1应用程序。现在我已经创建了一个uwp更新。我的问题是: 如果我将应用程序的更新加载到商店中,并且用户执行此更新。应用程序是否被覆盖或卸载然后重新安装? ApplicationData.Current.LocalSettings中保存的设置是否已删除?
thx newone
答案 0 :(得分:2)
TL; DR; - 从 WP8.1运行时更新时,它会保留 LocalFolder 和 LocalSettings 中的数据到 UWP (使用 Insider预览 - 快速响铃在设备上使用移动设备进行测试。)
我进行了类似的测试,like the last time:
用于测试的按钮代码:
private async void Generate_Click(object sender, RoutedEventArgs e)
{
StorageFile file = await ApplicationData.Current.LocalFolder.CreateFileAsync("test.txt");
await FileIO.WriteTextAsync(file, "Something inside");
}
private async void CheckFile_Click(object sender, RoutedEventArgs e)
{
try
{
StorageFile file = await ApplicationData.Current.LocalFolder.GetFileAsync("test.txt");
string text = await FileIO.ReadTextAsync(file);
await new MessageDialog($"File exists = {text}").ShowAsync();
}
catch (Exception) { await new MessageDialog("File desnt exists").ShowAsync(); }
}
private void GenerateSetting_Click(object sender, RoutedEventArgs e) => ApplicationData.Current.LocalSettings.Values["CHECK"] = "Test value";
private async void CheckSetting_Click(object sender, RoutedEventArgs e)
{
if (ApplicationData.Current.LocalSettings.Values.ContainsKey("CHECK"))
await new MessageDialog($"Setting exists = {ApplicationData.Current.LocalSettings.Values["CHECK"]}").ShowAsync();
else await new MessageDialog("Setting doesn't exist").ShowAsync();
}