如何获取 StorageFile 文件包含数据?如果不是那么
AreaTextBlock.Text = "1.8;"
我当前的代码是:
private async void Button_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
StorageFile file = await ApplicationData.Current.LocalFolder.CreateFileAsync("text.txt", CreationCollisionOption.OpenIfExists);
await FileIO.WriteTextAsync(file, "1.9");
}
private async void SettingsPage_Loaded(object sender, RoutedEventArgs e)
{
StorageFile file = await ApplicationData.Current.LocalFolder.CreateFileAsync("text.txt", CreationCollisionOption.OpenIfExists);
AreaTextBlock.Text = await FileIO.ReadTextAsync(file);
}
在按钮点击 AreaTextBlock.Text 是 1.9 但我需要当按钮从不点击时 AreaTextBlock.Text 应该是 1.8
我不想在 xaml 或 c# 初始化中编写 AreaTextBlock.Text = "1.8",因为当退出并重新启动时,AreaTextBlock.Text 是 1.8,即使它的文本是 1.9。那么怎么做