0
如何获取StorageFile文件包含数据?如果没有的话StorageFile是否包含数据(windwos电话)
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.9,也是如此。 所以该怎么做
哈哈我在使用此代码之前AreaTextBlock.Text =等待FileIO.ReadTextAsync(file); 这就是为什么它现在不工作的原因,谢谢.. –