【问题标题】:Isolated Storage to Local App Data本地应用数据的隔离存储
【发布时间】:2015-08-31 19:07:19
【问题描述】:

我目前正在将我的 Silverlight 项目更新/升级到新的运行时/通用应用程序。

有人可以帮我隔离存储到本地应用数据吗? 我查看了 msdn 和其他资源,但找不到足够明确的答案。

如何将文本框中的文本/数据保存到本地应用程序数据中? 这是隔离存储代码的一部分:

Imports System.IO.IsolatedStorage

Dim highscoreISO As IsolatedStorageSettings = IsolatedStorageSettings.ApplicationSettings

highscoreISO.Add("Highscore", ScoreLabel.Text)

Private Sub MainPage_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
    If highscoreISO.Contains("Highscore") Then
        HighScoreLabel.Text = "Highest Score: " & highscoreISO("Highscore").ToString
        ScoreLabel.Text = highscoreISO("Highscore").ToString
    Else
        HighScoreLabel.Text = "Highest Score: 0"
    End If
End Sub 

【问题讨论】:

    标签: vb.net silverlight windows-phone-8.1 win-universal-app


    【解决方案1】:

    看看Quickstart: Local app data 它有 C# 和 VB 的代码示例。

    如果您想继续使用文件,只需获取 StorageFolder 对象,然后使用 StorageFile 对象。要获取应用程序特定的本地文件夹,请执行以下操作:

    Dim localFolder As Windows.Storage.StorageFolder = Windows.Storage.ApplicationData.Current.LocalFolder
    

    【讨论】:

    • 感谢您的回复,我看过该帖子几次,但是我找不到有关将数据从文本框保存到本地应用程序数据的部分。你能帮帮我吗?
    • 查看文档的“从设置中读取数据”部分。您只需从 localSettings 分配/读取。
    猜你喜欢
    • 2016-02-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-15
    • 2020-05-07
    相关资源
    最近更新 更多