2016-03-29 343 views
0

我在商店中有一个Windows Phone 8.1应用程序。现在我创建了一个uwp更新。我的问题是: 如果我将应用程序的更新加载到商店中并且用户执行此更新。该应用是刚刚覆盖或卸载,然后新安装的? ApplicationData.Current.LocalSettings中保存的设置是否被删除?8.1应用程序的商店更新为uwp应用程序

THX newone

回答

2

TL; DR; - 从WP8.1运行时更新到UWP( - 快速环与移动设备与内幕预览测试)时它保留在LocalFolderLocalSettings数据。

我碰到类似的测试,like the last time

  1. 我已经发布了应用程序的测试版本 - WP8.1运行。
  2. 在电话安装成功后,我创建了一个LocalFolder文件和设置值LocalSettings(见下面的代码),
  3. 我已经提交的更新 - 去商店选择的应用程序,点击更新然后,一段时间后,浏览你的文件并选择了新生成的appxbundle(我有删除旧的WP8.1包),保存并提交。
  4. 一段时间后,我的电话被告知有该App的更新 - 我点击更新
  5. 安装成功后,我发现这是一个新的应用程序,我点击我的特殊按钮,检查LocalFolder和值在LocalSettings - 我看到有从WP8.1版本的旧值。

    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(); 
    } 
    

为用于测试按钮的代码

相关问题